0

var

what kind of names are accepted by javascript variables?

3rd May 2019, 6:08 PM
Vaibhav Vishal
Vaibhav Vishal - avatar
2 Answers
+ 1
The first character must be a letter, an underscore (_), or a dollar sign ($). Subsequent characters may be letters, digits, underscores, or dollar signs. Numbers are not allowed as the first character. Variable names cannot include a mathematical or logical operator in the name.
3rd May 2019, 6:21 PM
Pikachu
Pikachu - avatar
0
javaScript has only a few rules for variable names: The first character must be a letter or an underscore (_). You can't use a number as the first character. The rest of the variable name can include any letter, any number, or the underscore. You can't use any other characters, including spaces, symbols, and punctuation marks. As with the rest of JavaScript, variable names are case sensitive. That is, a variable named Interest_Rate is treated as an entirely different variable than one named interest_rate. There's no limit to the length of the variable name. You can't use one of JavaScript's reserved words as a variable name. All programming languages have a supply of words that are used internally by the language and that can't be used for variable names because doing so would cause confusion (or worse). Note, too, that JavaScript also has many keywords that should be avoided as well.
3rd May 2019, 7:23 PM
Abdelkader settah
Abdelkader settah - avatar