In javascript, variables have meaningful names, these names are called identifiers. Identifiers are unique, it means once a variable name is declared or used, it cannot be used for other variable.

Javascript Identifiers naming rules

  1. Javascript supports Unicode characters, Hence other language words or characters can be used as variable names.
  2. Identifier must start with a letter or underscore or dollar symbol and then digit can be used, No other operator or symbol is allowed.
  3. Identifier must not start with a number.
  4. There should not be space between letters, digit or words.
  5. Javascript is a case-sensitive language, so a and A are not same.
  6. Variable names should not contain reserved keywords.

Valid Identifiers example

Below are the few valid javascript identifier name examples.

<script>
$age = 30;
_name = 'yourshala';
$_country = 'India';
language = 'Hindi';
programming_language = 'javascript';
airQuality = 'Good';
isRaining = true;
isAge30 = false;
</script>

Invalid Identifiers example

<script>
0name = 'yourshala';  // Error
programming language = 'javascript'; // Error
</script>