Javascript Syntax

JavaScript can be implemented using JavaScript statements that are placed within the script HTML tags in a web page. You can place the script tags, containing your JavaScript, anywhere, but it is recommended that you should keep it within the head tags.


Case Sensitivity

JavaScript is case sensitive. It is common to start the name of a constructor with a capitalised letter, and the name of a function with a lower-case letter.


Whitespace and Semicolons

whitespace in JavaScript source can directly impact semantics. JavaScript allows you to omit this semicolon if each of your statements are placed on a separate line.


Comments in JavaScript

Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.


Any text between the characters /* and */ is treated as a comment. This may span multiple lines.


JavaScript also recognizes the HTML comment opening sequence


The HTML comment closing sequence –> is not recognized by JavaScript so it should be written as //–>.


JavaScript Operator

JavaScript operators are symbols that are used to compute the value or in other word we can perform operations on operands.


Arithmetic operators ( +, -, *, / ) are used to compute the value and Assignment operator ( =, +=, %= ) are used to assign the values to variables.


JavaScript Data Types

There are two types of data types in JavaScript.


Primitive data type


Non-primitive (reference) data type


primitive data types

There are five types of primitive data types in JavaScript.


String – Number – Boolean – Undefined – Null


non-primitive data types

Array – Object – RegExp

Posted In: Javascript


You must log in to post a comment