字符串 Concatenation 测验
单选题 入门
题目
什么是 result 的 `"5" + 3` in JavaScript?
提示
当 one operand 是字符串, + 做 concatenation.
解释
当要么 operand 的 + 是字符串, JavaScript 执行字符串 concatenation, converting other operand 到字符串. 所以 "5" + 3 becomes "5" + "3" = "53" (a string). This is a common source of bugs — use 数字() or template literals 到是 explicit.
相关资源
相关课程
- JavaScript 数据类型
学习关于类型 coercion.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。