admin管理员组

文章数量:1126140

Which characters can be used for naming a JavaScript variable?

I want to create a small "extension library" for my non-JavaScript users here at work (who all seem to be squeamish when it comes to the language). I love how jQuery and Prototype have both use the $ dollar sign, and since I use jQuery, I'm looking for another nice single-character symbol to use.

I realize that I could just test out a number of characters, but I'm hoping to narrow down my list of characters to start with (in consideration of future integration with another popular library, perhaps).

Which characters can be used for naming a JavaScript variable?

I want to create a small "extension library" for my non-JavaScript users here at work (who all seem to be squeamish when it comes to the language). I love how jQuery and Prototype have both use the $ dollar sign, and since I use jQuery, I'm looking for another nice single-character symbol to use.

I realize that I could just test out a number of characters, but I'm hoping to narrow down my list of characters to start with (in consideration of future integration with another popular library, perhaps).

Share Improve this question edited Jun 7, 2018 at 15:42 Machavity 31.6k27 gold badges95 silver badges105 bronze badges asked Nov 2, 2009 at 13:04 Richard ClaytonRichard Clayton 7,5323 gold badges24 silver badges19 bronze badges 1
  • 19 If you're just looking for alternative symbols, the Greek alphabet is valid (eg, αβγδεζηθικλμνξοπρσςτυφχψω)... or if you want to really mess up your other developers, you could go with the English alphabet, but in an alternative font (eg., ABCDEFGHIJKLM NOPQRSTUVWXYZ abcdefghijklm nopqrstuvwxyz) ...also valid!

    本文标签: What characters are valid for JavaScript variable namesStack Overflow