JS Basic Concepts


In this tutorial we will learn about JavaScript Basic Concepts.


JavaScript borrows most of its syntax from languages like C/C++, Java, Python etc.

Case sensitive

JavaScript is case-sensitive language. This means lower case letters and upper case letters are treated differently. For example, name and Name are different even though they are the same word.


Programs are list of instructions that are executed by the computer. JavaScript programs are instructions that are executed by the web browser.


JavaScript statements are the instructions written by a programmer.


Every instruction in JavaScript ends with a semicolon ;

In the following example we have an instruction that will print "Hello World" in the browser console.

console.log("Hello World");


The smallest individual unit in a program is called token.

List of JavaScript tokens.

  • Reserved Keywords
  • Identifiers
  • Punctuators
  • Literals

Reserved Keywords

Reserved keywords are words that carry a special meaning and must not be used to name variables and functions.

Click here for JavaScript Variables.
Click here for JavaScript Functions.

Following are some of the commonly used JavaScript reserved keywords.



Identifiers are sequence of characters that are used to name the variables, functions etc.

Characters of an identifier can be a letter, digit, dollar sign and underscore. The first character cannot be a digit.

  • Letter a-z A-Z
  • Digit 0-9
  • Dollar sign $
  • Underscore _

Following are valid identifiers.


Following are invalid identifiers.



Following are the list of punctuators that we use in JavaScript.



We use literals to represent value in JavaScript.

List of literals.

  • Null literal
  • Boolean literal
  • Numeric literal
  • String literal

Null literal

The value of the Null literal is null. It represent null or empty.

Boolean literal

The value of the Boolean literal are true and false. These are logical values.

Numeric literal

We use Numeric literal to represent numbers or numerical value.

Following are the types of numerical values.

  • Decimal
  • Hexadecimal
  • Octal

Decimal number are base 10 i.e., they consists of 10 digits 0 to 9.

Hexadecimal number are base 16 i.e., they consists of 10 digits 0 to 9 and 6 letters a to f. Upper case A to F is also used. Hex number start with 0x and 0X.

Example: 0xA is in hex form and its decimal equivalent is 10.

Click here for Hexadecimal to Decimal conversion tutorial.

Octal number are base 8 i.e., they consists of 8 digits 0 to 7. Octal number starts with 0.

Example: 017 is in octal form and its decimal equivalent is 15.

Click here for Octal to Decimal conversion tutorial.

String literal

Strings are sequence of characters enclosed in double and single quote in JavaScript.

In the following example we have a string enclosed in double quote.

"Hello World"

In the following example we have a string enclosed in single quote.

'We are learning JavaScript.'