Javascript Syntax

Case Sensitive

Javascript is case sensitive language. Everything variables, functions are case sensitive.

var a1 = '10';
var A1 = '10'; 

Both a1 and A1 are different variables.

Comments

Comments in javascript are same as C-style comments. These are the comment formats of Javascript.

Single Line Comment -

// var a;

Multiline Comment -

/* This is
* multiline comment
*/

Javascript Identifiers

Javascript variable, function name, function argument must be in the following format.

  • The identifier name can be start with a letter, or dollar sign ($), or an underscore(_).
    These are the valid variable examples in Javascript.
    var
    $var
    _var
    var23
  • All reserved words cannot be used as identifier name.

Statement termination

The javascript statement is terminated with semicolon.

var a1 = 10;    




Read more articles


General Knowledge



Learn Popular Language