admin管理员组文章数量:1426943
the code is:
console.log("\1" === "\u0001");//true
console.log("\01" === "\x01");//true
console.log("\001" === "\u0001");//true
why "\001" === "\u0001"
is true,who can tell me why?
the code is:
console.log("\1" === "\u0001");//true
console.log("\01" === "\x01");//true
console.log("\001" === "\u0001");//true
why "\001" === "\u0001"
is true,who can tell me why?
-
2
Because they're all the same character? If you were expecting the form seen in the literal syntax to be pared, you'd need to escape the
\
character.console.log("\\1" === "\\u0001");// false
– I Hate Lazy Commented Oct 10, 2012 at 15:34 - They are all the same character. Those are different ways to escape it. – gen_Eric Commented Oct 10, 2012 at 15:35
1 Answer
Reset to default 5All of those strings are a single character; namely, Unicode code point 1.
Those are different ways of escaping it in the string literal.
本文标签: escapingWhy quot01quotquotu0001quot is true in javascriptStack Overflow
版权声明:本文标题:escaping - Why "01" === "u0001" is true in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745394150a2656736.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论