JavaScript Syntax

Syntax is basically a set of rules applied or to keep in mind, while creating a JavaScript program. For example, JavaScript is a case-sensitive language. Therefore firstname and FirstName are two different variables.

Use var, let, or const to create variables in JavaScript. For example:

var x;

Or

let firstname;

String must be quoted using a single or a double quotes. For example: 'fresherearth' and "fresherearth"

Use // to write a single-line comment. For example:

x = 10;      // a comment

And use /* some comment text */ to write a multi-line comment. For example:

/*
   some 
   comment
   text
*/

Here are the list of some topics that are required to learn before start programming with JavaScript:

The list continues. The topics given above are the most important, while talking about syntax of a JavaScript program.

JavaScript Online Test


« Previous Tutorial Next Tutorial »