Data Types In Javascript
In javascript variables are used to store the information, you can learn variables in detail ( here).
let us discuss what are the Data types and what type of data we can store in variables.
A data type is a classification that defines which type of value a variable has( number, string, etc) and what type of mathematical, relational, or logical operations can be applied to it without causing an error.
data types are those, In which can tell what kind of data is being stored in a variable.IT can be either number, string, objects, etc.

In javascript, we can categorize the data types in the following two types:-
Primitive Type
The primitive type is the basic building block. It is the predefined data type that is not an object and has no methods. The primitive value can’t change its immutable nature. It can contain a single value which can either be a string, a number, or some other primitive form.
we have 7 primitive data types in javascript
Number — The number data type represents the integer and the floating-point numbers. A number type can also be +Infinity, -Infinity, and NaN (not a number).For example,

String — JavaScript’s String data type is used to represent the text-based data.For example,

Boolean — This data type is used to represent the logical entities. Boolean can either be true or false. It is like a switch that can either be yes or no. For example,

Undefined — The value that is not assigned comes under an undefined data type. If a variable is declared but the value is not assigned to it, then the value of that variable will be undefined. For example,

Null — In JavaScript, there is a special value that represents an empty or unknown value known as null. For example,

BigInt — Number type can only represent numbers in the range -(253–1) and (253–1) in JavaScript. However, if you want to use a number bigger than that, you can use the BigInt data type. For example,

Symbol — This data type was recently introduced in a newer version of JavaScript (from ES2015).symbol value is the data type Symbol can be referred to as a . Symbol is an immutable primitive value that is unique.For example,

Though val_1 and valu_2 both contain ‘abc’, they are different as they are of the Symbol type.
Non-Primitive Type
The data types that are derived from primitive data types of the JavaScript language are known as non-primitive data types. These data types are used to store the collection of data and more complex entities like objects.
Objects — The object is a complex data type that allows you to store collections of data. An object contains properties, defined as a key-value pair. A property key (name) is always a string, but the value can be any data type, like strings, numbers, booleans, or complex data types like arrays, functions, and other objects. For example,

Note — JavaScript is a dynamically typed (loosely typed) language. JavaScript automatically determines the variables’ data type for you. It also means that a variable can be of one data type and later it can be changed to another data type.
typeof — To find the type of a variable, you can use the typeof operator. For example,

instanceof->To find an object that was constructed by a certain constructor or one inheriting from it, we use the instanceof operator.For example,
