Datatypes :
Primitive Data types
The Primitive Data types in JavaScript include Number, String, Boolean, Undefined, Null and Symbol.
Non-Primitive data : The Non-Primitive data type has only one member i.e. the Object. JavaScript arrays and functions are also objects.



Boolean :
It represents only true or false based on condition.

Number:
It can be written with or without decimals.
Example : var num1 = 32;

String:
It is used to store texts and inside of either double or single quotes.

Example : var str_one = 'Best Interview Question';

Null:
It is "nothing" but supposed to be something that does not exist.

Undefined:
It has no value but variable is exists.
Example : var MyVariable_1;
console.log(MyVariable_1); // undefined

Symbol:
It is new in ES6. It is an immutable data type that have unique value.
Example : const BestInterviewQuestion = Symbol(‘BestInterviewQuestion’);

Number: JavaScript has only one type of numbers. Numbers can be written with, or without decimals:
let x1 = 34.00; // Written with decimals
let x2 = 34; // Written without decimals
String:Strings are written with quotes. You can use single or double quotes:
var data= "String"
boolean: it will tell the given condition is True or False or Satisfiyingn and un Satisfiying
dont use capital letters (True or False) -> (true or false)
undefined: we defined a variable but we dont assign a value to that variavble
let car; // Value is undefined, type is undefined
Null:
NaN property : NaN property represents “Not-a-Number” value. It indicates a value which is not a legal number.

typeof of a NaN will return a Number .
To check if a value is NaN, we use the isNaN() function,
Note-

isNaN() function converts the given value to a Number type, and then equates to NaN.

isNaN("Hello") // Returns true
isNaN(345) // Returns false
isNaN('1') // Returns false, since '1' is converted to Number type which results in 0 ( a number)
isNaN(true) // Returns false, since true converted to Number type results in 1 ( a number)
isNaN(false) // Returns false
isNaN(undefined) // Returns true


undeclared and undefined :

Undeclared variables are those that do not exist in a program and are not declared.
If the program tries to read the value of an undeclared variable, then a runtime error is encountered.


Undefined variables are those that are declared in the program but have not been given any value.
If the program tries to read the value of an undefined variable, an undefined value is returned.