Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我预计 JSTD 将“000011”(字符串)视为不等于 11(数字)。
但是,看看他实际的 JSTD 代码,assertEquals 返回
(a === e)
仅当元素之一是对象时,否则返回
(a == e)
这不是错的吗?
我无法真正回答您的主要问题(断言实现是否“错误”),但要了解您正在尝试做的事情,您始终可以这样编写断言:
var str = '000011'; var num = 11; assertTrue(str !== num);
或者,如果您想确保两个变量具有相同的值和类型:
assertTrue(str === num);