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.

6
  • Did you try it and see? Commented Jun 16, 2015 at 12:23
  • 2
    @epascarello: Try what exactly? Every possible combination of ASCII characters? Commented Jun 16, 2015 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. Commented Jun 16, 2015 at 12:26
  • mathiasbynens.be/notes/javascript-identifiers Commented Jun 16, 2015 at 12:26
  • 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. Commented Sep 25, 2015 at 7:39

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Nice and clear answer, thank you

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.