You are on page 1of 1

1. Declare variable in JS. Use the let keyword.

let name; //by default undefined.


let name = "Mosh"; //can use single quote or double quote
//variable names are case sensitive.

2. Declare constant in JS. Use the const keyword.

const intersetRate = 0.3;

3. Primitive data types are string, number, boolean, undefined and null.
e.g.
let name = 'Subash'; //string literal
let age = 20; //number literal
let isOkay = true; //boolean literal
let firstName = undefined; //every unassigned variable is undefined in the
beginning.
let lastName = null; // used in situations where we want to explicitly clear the value
of // a variable.

4. JS is a dynamically typed language.


e.g.
>>let name = 'Subash'; 
>>typeof name
>>"string"
>> name = 1;
>> typeof name 
>> "number"

You might also like