You will learn :-
1) Types of data type
2) primitive data types
3) non-primitive data types
4) difference between all the data types.
Prerequisites:- basics of programming.
Data type:- Data type provides the information about the value which is being stored in the variable.
1) Primitive data type
2) Non-primitive data type
1) Primitive Data types: — Primitive data types are the primary data types. For example Number, String, Boolean
There are 5 primitive data types
Let’s discuss all of them one by one.
a) String: — String data contains series of characters enclosed in double quotes (“”) Or single quotes(‘’).
Now we can use back ticks as well for dynamically assigning values in the string.
In the above example, all the three variables are string. name variable is enclosed in “” double quotes, country variable is enclosed in ‘’ single quote and then description which is enclosed in `` back ticks where we assigning values dynamically.
b) Number :- Number data type contains number values in the variable.
Number values can be in decimal as well. There are methods which can convert the decimal to integer or integer to decimal.
c) Boolean:- Boolean data type contains true or false value in the object.
In the above example we have taken boolFlag and assigned value as true and then we have printed the data type of the variable. Then boolFlag value changed to false and again we have printed it’s data type.
d) undefined :- Any object which is not defined with the value will have undefined as data type and it’s value will also be as undefined.
In the above example value is not assigned to the name variable while declaring it. And then after declaring the variable it’s data type is getting printed.
Non-primitive Data Types:- These types are collection data types where multiple primitive data type values are stored in one variable.
Below are the two primitive data types.
1) Array:- Array data type stores multiple values in single variable. Values can be accessed through their index numbers. Index number always starts from 0. It means that the first value will be at the 0th index number in the array.
2) Object:- Object data type stores data in the key value pair. There is one constraint that the key should of type String.
In the above example “countries” variable has been taken and array of string values are assigned to it and then we have printed it data type. Output is showing object for array it means array is also of type object and object where data is stored in Key-value pair is also of type object.
BHAGAVAD GITA:- The song of God
Sattva binds one to material happiness; rajas conditions the soul toward actions; and tamas clouds wisdom and binds one to delusion.