Naming conventions in JavaScript

When naming a variable, camleCase is used, most of the times by most of the programmers.
There are some limitations in naming variable in JavaScript.

  • The name must only contain letters, digits, symbols, $ and _.
  • The first character must not be a digit.
  • Variable name should not be Reserved words.

These are the valid names of the variables.


let $ = 12;
let _ = 13;
let $abc = 34;
let validName = "This is valid name";
let Name2 = "valid";
let name_name = "valid";
                    

These are invalid names of variables.


let 1Name;
let name-2;
                    

Conclusion

In this section, you learned about the naming conventions in JavaScript.
In next section, you will learn about Reserved words in JavaScript.