两个相同的字符串如何彼此不相等? [英] How do two identical strings not equal each other?
本文介绍了两个相同的字符串如何彼此不相等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人发给我这封电子邮件:
Someone sent me this email:
为什么这两个警告都是假的?
Why do both of these alert to false?
alert('a' == 'a');
alert('a' === 'a');
这是一个演示
推荐答案
这是一招吗?您是否使用一些特殊的unicode魔法生成了 a
?我删除了 a
并重新输入了它们,现在两个警报显示 true
,因为它们应该
Is this a trick? Did you generate those a's
with some special unicode magic? I deleted the a's
and re-typed them, and now both alerts show true
, as they should
这篇关于两个相同的字符串如何彼此不相等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文