Variable part, 4

Variables
34
4/5













Naming Variables
JavaScript variable names are case-sensitive.
In the example below we changed x to uppercase:
This code will not result in any output, as x and X are two different variables.
Naming rules:
- 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. For instance, 2*something or this+that;
- JavaScript names must not contain spaces.
Hyphens are not allowed in JavaScript. It is reserved for subtractions.
What characters can be used to start a variable?
Select all that apply
Comments
Post a Comment