1

I've seen this other question, unfortunately the answers spend too much attention on Unicode and say nothing about normal ASCII characters.

I need to know which 7-bit ASCII characters (0..127) are valid in a Javascript identifier name.

Alex R
  • 11,364
  • 15
  • 100
  • 180
  • Did you try it and see? – epascarello Jun 16 '15 at 12:23
  • 2
    @epascarello: Try what exactly? Every possible combination of ASCII characters? – BoltClock Jun 16 '15 at 12:24
  • 1
    "the answer is too convoluted" - it's reasonably clear isn't it? True there are lots of character categories, but if you click through the links you'll see they're in code point order and many of them don't have any codes <= 0x7f, which are the ASCII codes you want. – Rup Jun 16 '15 at 12:26
  • https://mathiasbynens.be/notes/javascript-identifiers – epascarello Jun 16 '15 at 12:26
  • Sorry, "too convoluted" is not a valid reason to post the same question yet again. There are many good answers there, does [this one](http://stackoverflow.com/a/6671856/989121) help? – georg Jun 16 '15 at 12:50
  • 1
    I think it's a perfectly valid question. Sure, there are thousands of Unicode characters that are allowed in theory. In practice, however, most developers will stick to ASCII identifiers, so it's great to have a succinct answer. – Daniel Wolf Sep 25 '15 at 07:39

1 Answers1

3

According to this article, this is all about javascript variables :

The general rules for constructing names for variables (unique identifiers) are:

Names can contain letters, digits, underscores, and dollar signs. Names must begin with a letter Names can also begin with $ and _ Names are case sensitive (y and Y are different variables) Reserved words (like JavaScript keywords) cannot be used as names

You can use all ASCII codes. but you have to comply with above rules.

Community
  • 1
  • 1
Manoochehr Dadashi
  • 715
  • 1
  • 10
  • 28