我注意到,在Internet Explorer中(但不幸的是,在我测试的其他浏览器中不是),您可以使用一些Unicode变量名.这让我很开心,我非常高兴能像这样编写充满Unicode的有趣代码:
var ктоείναι草泥马 = "You dirty horse.",
happy☺n☺mat☺p☺eia = ":)Yay!",
ಠ_ಠ = "emoticon";
alert(ктоείναι草泥马 + happy☺n☺mat☺p☺eia + ಠ_ಠ);
然而,由于某些原因,◎ܫ◎
、♨_♨
和☺
不是有效的变量名.
为什么ಠ_ಠ
和草泥马
可以工作,而◎ܫ◎
、♨_♨
和☺
不行?
EDIT: Test it out in your browser on JSFiddle. I've tested it in Internet Explorer 9, Chrome, Firefox, and Opera. So far, it seems to only work in Internet Explorer 9. (I don't know about Internet Explorer 8 and below.) Let me know if it works in another browser.