Data Types In JavaScript

abdulganiyy

abdulganiyy

Posted on January 21, 2020

Data Types In JavaScript

In JavaScript, there are seven data types. Six data types are primitive and one is non primitive.

PRIMITIVE DATA TYPES

  1. 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.

  2. 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".

  3. Boolean: Boolean values can either be True or False. A truthy value simply means yes and a falsy value means no.

  4. Null: When a null value is assigned to a variable in JavaScript, this denotes that the value is not in existence.

  5. 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.

  6. 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...

💖 💪 🙅 🚩
abdulganiyy
abdulganiyy

Posted on January 21, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

JavaScript Data Types
javascript JavaScript Data Types

May 27, 2020

Data Types In JavaScript
javascript Data Types In JavaScript

January 21, 2020