In JS, Variables donβt have type- Values have types π
JavaScript has 8 Datatypes
String
Number
Bigint
Boolean
Undefined
Null
Symbol
Object
The Object Datatype
An object
An array
A Function
<aside>
π‘ To know the datatype, of x typeof x
</aside>
let str="Hello";
console.log(str);
console.log(str[1]);
console.log(str.charAt(1));
console.log(typeof str);
let obj={
name: "Abc",
age: 11
}
console.log(obj);
console.log(typeof obj);
let arr=[1,2,3,4,5];
console.log(arr);
console.log(arr[0]);
console.log(typeof arr);
function fun(where){
console.log("Function is called "+where);
}
fun("Here");
console.log(typeof fun);
<aside> π‘ All Permeative data types are immutable in JavaScript
</aside>