编写 Arrow 函数
填空题 入门
题目
Fill in 空白到 创建 arrow 函数那个返回 square 的 x.
代码
const square = (x) => ___;
console.log(square(5)); // 25
提示
arrow 函数使用表达式请求体返回那个表达式.
解释
当 arrow 函数请求体是 单个表达式 (否 curly braces), 它是 implicitly returned. x * x 是表达式那个 computes square. 所以 square(5) 返回 5 * 5 = 25.
相关资源
相关课程
- JavaScript 函数
学习关于 arrow 函数.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。