const isString = (a, b, c) => {
if (((typeof a) == "string") && ((typeof b) == "string") && ((typeof c) == "string")) {
return "strings";
}
return "not strings";
}
为什么需要在参数之后的 =>
才能使其工作?我通过反复试验得到了正确的测试问题,但我不明白为什么没有 =>
就无法工作。
这里是说明。
Create a function called "isString" that takes 3 arguments (x1, x2, x3)
- Check if each argument is a string using typeof.
- If each argument is a string, return "strings".
- If each argument is NOT a string, return "not strings".
最佳答案
=> 是箭头函数的语法
关于javascript - 需要澄清为什么代码是正确的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70149286/