Fundamentals of JavaScript

Learn the commonly used data types and operators in JavaScript.

Types of data in programming

Several forms of data may be used in programming. Here’s an example:

let persons = 1;
let greet = "Hello!";

In the example above:

  • The variable, persons, stores a number.
  • The variable, greet, stores a string.

Variable declaration

In JavaScript, we use let to declare a variable. Here’s an example:

let persons; // declaring a variable

Here, the variable persons is declared, but its value is undefined.

Note: It is a good practice to initialize every variable.

Variable initialization

Assigning a value to a variable at the time of its declaration is ...