Vishal
asked

Expert
Kelish Rai answered
In JavaScript, variable names cannot start with a number. They need to begin with a letter, an underscore (_
), or a dollar sign ($
). However, you can use numbers in the middle or at the end of the variable name.
For example, these are valid variable names:
myVariable1
variable_2
$_value
But these are not valid:
1stVariable
123name
Note: If you try to start a variable name with a number, JavaScript will throw a syntax error when you run the code.
JS
This question was asked as part of the Learn JavaScript Basics course.