Truthiness 概念
概念检查 中等
题目
哪个的 following 值是 falsy in JavaScript?
提示
Falsy 值是: 假, 0, '', 空, undefined, NaN.
解释
In JavaScript, the falsy values are: false, 0, -0, 0n, "", null, undefined, NaN. Everything else is truthy. 0 is falsy. But "假" (a non-empty string), [] (an empty array), and "0" (a non-empty string) are all truthy. This is a common source of bugs.
相关资源
相关课程
- 布尔值 Logic
学习关于布尔值 logic and 运算符.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。