What is DataTypes?

Datatypes are nothing but different forms of data ie: strings, numbers, boolean etc

const age = 18; // number
const name = "kaarthik" // string
const boy = true; // Boolean

Boolean

JavaScript's String type is used to represent textual data & string is enclosed between ' ' or " " quotes.

const name = "kaarthik" // string

Boolean

Boolean represents a logical entity and can have two values: true and false.

const boy = true; // Boolean

Undefined

when we declare a variable and doesn't assign any values it means that the variable is undefined.

let age; 
console.log(age);
console.log(typeOf age); // Undefined

Null

It means that particular variable known to exsist but doesn't have any value.

let age = null;
console.log(typeOf age); // Null

we can view the type of a particular data using typeof method

console.log(typeOf age); // Number
console.log(typeOf string); // String