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
Basically, in regular expression form: [a-zA-Z_$][0-9a-zA-Z_$]*
. In other words, the first character can be a letter or _ or $, and the other characters can be letters or _ or $ or numbers.
Note: While other answers have pointed out that you can use Unicode characters in JavaScript identifiers, the actual question was "What characters should I use for the name of an extension library like jQuery?" This is an answer to that question. You can use Unicode characters in identifiers, but don't do it. Encodings get screwed up all the time. Keep your public identifiers in the 32-126 ASCII range where it's safe.