JavaScript - Tokens, Identifiers and Literals

Tokens :

It is a smallest unit of any programming language which consists
  • Keywords
  • Identifiers
  • Literals / Values

    i. Keywords
    It is a predefined reserved words which can be understandable by the javscript engine. It should be always in lowercase.

    ii. Identifiers
    Name given by the programmer to the components of javascript like variables, functions etc.,

    Rules :
  • An Identifier should not start with number.
  • Except $ and _(underscore) no special characters are allowed.
  • We can't use ke yword as identifiers.

    iii. Variables / Literals :
    A named block of memory which is used to store a value is known as variables. It is a container to store data.

    Note :
  • In javascript variables are not strictly typed, it is a dynamically typed, therefore it is not necessary to specify the type of data during variable declaration.
  • In a variable we can store any type of values.
  • It is mandatory to declare a variable before using it.
    
      Eg:
    
       var/let/const                 identifier
       (keywords)        (variable declaration & initialization )
    
         var                  a=10;
    
    


    (JS - Comments, Variables)