我知道空字符串在 javascript 中是假的,非空字符串在 javascript 中是真。
但是,为什么 'false'
在 javascript 中是真实的,规范中是否有任何明确的内容?这是性能问题还是在某些情况下您希望字符串 'false'
代表 true
?
最佳答案
is there anything explicit in the specification?
Yes :
The result is false if the argument is the empty String (its length is zero); otherwise the result is true.
关于javascript - 为什么 'false' 在 javascript 中是真实的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32720503/