Strict 对比 Loose Equality
概念检查 中等
题目
哪个语句关于 `==` and `===` 是正确?
提示
=== 是 strict equality 运算符.
解释
=== (strict equality) compares 两者都值 and 类型不使用任何类型 coercion — 5 === "5" is false. == (loose equality) coerces operands to the same type before comparing — 5 == "5" is true. Best practice is to always use === 到 avoid unexpected coercion bugs.
相关资源
相关课程
- JavaScript 数据类型
学习关于 equality 运算符.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。