Javascript - alert(" zoo">" house")返回true [英] Javascript - alert("zoo">"house") returns true

查看:143
本文介绍了Javascript - alert(" zoo">" house")返回true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

alert(zoo>house)返回 true
有谁可以解释我为什么?

alert("zoo">"house") returns true.
Could anyone explain me why?

推荐答案

因为它进行词汇比较,而 z 是大于 h (即 z 代码单元具有更高的数值比 h 的代码单位。如果两个字符串都以相同的字符开头,则会检查第二个字符,依此类推。有关swgid细节的详细信息,请参阅规范中的

Because it does a lexical comparison, and z is greater than h (that is, the code unit for z has a higher numeric value than the code unit for h). If both strings started with the same character, the second character would be checked, and so on. Full details in turgid detail in the spec.

这篇关于Javascript - alert(" zoo">" house")返回true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆