JavaScript Identifiers
Notes:
JavaScript Identifiers :
Identifier: (User defined names)
Identifier is a sequence of characters; which help us to identify specific part of a program.
Identifiers are names given to the program elements by the programmer.
Ex:
name of a variable
name of a constant
name of an array
name of a function
name of an object
etc.
Naming conventions:
are the rules for writing identifier names
1. Identifiers should be meaningful.
2. Keywords should never be used as identifiers.
3. The first character can be an alphabet, underscore or dollar character.
4. The first character should not be a number.
5. All succeeding characters can be alphabets, a digits, or underscores.
6. No special characters are allowed except an underscore or dollar.
7. More than one successive underscores or dollars should not be used.
8. Identifiers are case sensitive.
Examples for valid and invalid identifiers:
Valid: s, p, Num, num, score, _flag, player9, $price, SCREEN_WIDTH, setWidth, Student etc.
Invalid: 9thplayer, _ _flag, $$balance, continue, etc.
Interview Questions: