We noticed that in Internet Explorer (but, unfortunately, not in the other browsers we tested), we can use some Unicode variable names.
For some reason, though, ◎ܫ◎, ♨_♨ and ☺ are not valid variable names. Why do ಠ_ಠ and 開心馬 work, but ◎ܫ◎, ♨_♨ and ☺ don't? I've tested it in Internet Explorer 9, Chrome, Firefox, and Opera. So far, it seems to only work in Internet Explorer 9. (We don't know about Internet Explorer 8 and below.) Let me know if it works in another browser.
ಠ_ಠ and 草泥马 only contain "letters" used in actual alphabets; that is, ಠ is a symbol from the Kannada alphabet, and 草泥马 consists of Chinese characters. ◎ and ☺, however, are purely symbols; they are not associated with any alphabet. The ECMAScript standard, chapter 7.6 (which all the browsers except Internet Explorer are following), states that an identifier must start with one of the following.
- a Unicode letter
- $ or _
- \ followed by a unicode escape sequence.
The following characters of an identifier must be one of the following.
- any of the characters permitted at the start
- a Unicode combining mark
- a Unicode digit
- a Unicode connector punctuation
- a zero-width-non-joiner
- a zero-width joiner
IE goes beyond the standard and is permissive enough to allow some symbols, such as ☺.
EcmaScript 262, section 7.6 says names must start with $, _, or a Unicode letter, and after that may contain either those characters, or Unicode combining marks, Unicode digits, or Unicode connector punctuation (and a couple of format-control characters that are language specific.) So, the difference between allowed and not allowed identifiers in our cases is probably whether the leading character is considered a "letter"
For the great justice: since most things in JS are "objects", we can use square-bracket syntax: