Data Types In JavaScript
abdulganiyy
Posted on January 21, 2020
In JavaScript, there are seven data types. Six data types are primitive and one is non primitive.
PRIMITIVE DATA TYPES
Number: This can be integers, decimal or floating point numbers.There are also special numbers namely; Infinity and NaN. Infinity is gotten by division with zero and NaN is as a result of incorrect mathematical operation.
Strings: They represent textual data. Strings can be a single character or combination of different characters. Single quotes, double quotes begin and end strings e.g 'sugarcrush' or "sugarcrush".
Boolean: Boolean values can either be True or False. A truthy value simply means yes and a falsy value means no.
Null: When a null value is assigned to a variable in JavaScript, this denotes that the value is not in existence.
Undefined: When a value of undefined is assigned to a variable, this denotes that a value has not been assigned to it. We can also define an undefined value by just declaring a variable without assigning it to any value or explicitly giving it a value of undefined.
Symbol: Symbols are unique identifiers in JavaScript.symbol is created using Symbol() and every value created using this is unique.
NON-PRIMTIVE
Objects are the only non primitive data types in JavaScript. They are used to store key-value pairs collection of items. Objects store complex entities. It can store all the data types discussed above.
Stay tuned for more tutorials...
Posted on January 21, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.