In the previous section, we mentioned a little bit about data types. Data or values have data types. Data types describe the characteristics of data. Data types can be divided into two:
1. Primitive data types
2. Non-primitive data types(Object References)
2. Non-primitive data types(Object References)
### Primitive Data Types
Primitive data types in JavaScript include:
1. Numbers - Integers, floats
2. Strings - Any data under single quote, double quote or backtick quote
1. Numbers - integers, floats
2. Strings - any data under single quote, double quote or backtick quote
3. Booleans - true or false value
4. Null - empty value or no value
5. Undefined - a declared variable without a value
6. Symbol - A unique value that can be generated by Symbol constructor
6. Symbol - a unique value that can be generated by Symbol constructor
Non-primitive data types in JavaScript includes:
@ -70,7 +70,7 @@ Non-primitive data types in JavaScript includes:
2. Arrays
Now, let us see what exactly primitive and non-primitive data types mean.
*Primitive* data types are immutable(non-modifiable) data types. Once a primitive data type is created we cannot modify it.
*Primitive* data types are immutable(non-modifiable) data types. Once a primitive data type is created we cannot modify it.
**Example:**
@ -191,7 +191,7 @@ const PI = Math.PI
console.log(PI) // 3.141592653589793
// Rounding to the closest number
// if above .5 up if less 0.5 down rounding
// Round up if above 0.5, round down if less than 0.5
console.log(Math.round(PI)) // 3 to round values to the nearest number