Computer Science, asked by phyton, 1 year ago

what are the rule for naming a
Java script variable?​

Answers

Answered by aliya346
4

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.

Answered by ankit6316
0

Explanation:

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.

Similar questions