Primitive Data Types :
Non-Primitive or Referenced Data Types
Objects (functions, arrays, String, Date, Math etc)
•Numbers between -(2^53 − 1) and 2^53 − 1
•Integer or floating point
•Have additional 3 symbolic values : +Infinity, -Infinity, NaN
•0 and -0
•BigInt is created by appending n to end or by constructor approach.
var num1 = 99984293840n;
var num2 = BigInt(123456);
•Boolean is a logical data type that can have only the values true or false.
• Generally used in conditional statements to decide which section of code to be executed.
var check = true;
var check = false;
•To represent textual data. •
•Anything between double quote(“ ”), single quote(‘’) and backtick(“) is a String
•The length of a String is the number of elements in it.
var test = ‘dummy’
var test = “23”
var test3 = `backtick`
•A variable that has not been assigned a value is of type undefined. •
•Undefined is not a reserved keyword. Its bad practice to use identifiers with name undefined.
var test ; // initialized with undefined
var test1 = undefined.
•Represent ‘empty’ or ‘nothing’ or ‘unknown’
•Usually represents intentional absence of any object value.
var test = null;
•Symbol is a primitive data type , that can be created using factory function symbol
•It returns a unique symbol
•Used to add unique property keys to object.
var test = Symbol();
•It contains named values called properties and methods.
•Objects can be created in 3 ways :
• Using Object literals.
•Using Object Constructors.
•Using Object.create() method.
•Use delete operator to delete a property or method of object.
•Fetch all keys of object using Object.keys().
Fore more detailed explaiantion with the help of examples, Please check below video:
Let me know in the comments section of video, if you have any questions or doubts.