Data Types in JavaScript

marlonlevi·2022년 7월 5일

We have two types of data types in JavaScript . One is Primitive and other one is Non -Primitive data types

In Primitive Data Types , we have :

1) Number (Unlike java , we dont have int,float,double,BigInteger we only have number )

2) Boolean(return True or false)


4) undefined (when a variable is defined and not assigned a value
then it gives value as undefined)

5)null (absence of any value)

6)bigInt - used to store very large numbers

7) Symbol - Symbols are often used to add unique property keys to an object that won't collide with keys any other code might add to the object, and which are hidden from any mechanisms other code will typically use to access the object. That enables a form of weak encapsulation, or a weak form of information hiding

Non -Primitive Data Types, we have :

1)Array (collection of data of same data type, it is just like java)

2) Object (collection of several data types under a single heading called as Object)

3)Function (when some lines are to be executed several times , functions are used.)


//typeof (number ,string , null,boolean , undefined)
console.log("data type is ->"+typeof name );
console.log("data type is ->"+typeof number );
console.log("data type is ->"+typeof sachkasamna );
console.log("data type is ->"+typeof nullval );
console.log("data type is ->"+typeof unde );

ans ->

Hi folks! I am Ben. NFTs, cryptocurrencies and Blockchains are my jams. Hoping I would give you helpful articles ❤

0개의 댓글