update 02_day_data_types.md

update 02_day_data_types.md
pull/886/head
Raphael 1 year ago
parent 55d8e3dbc0
commit 2c7369782d

@ -51,18 +51,18 @@
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
@ -235,12 +235,14 @@ console.log(Math.log(10)) // 2.302585092994046
console.log(Math.LN2) // 0.6931471805599453
console.log(Math.LN10) // 2.302585092994046
// Trigonometry
// Trigonometry (the angle must be in radians)
// If you want to use degrees, you have to first convert it to radians
// Angle in radians = Angle in degrees x PI / 180
Math.sin(0)
Math.sin(60)
Math.sin(1.05)
Math.cos(0)
Math.cos(60)
Math.cos(1.05)
```
#### Random Number Generator

Loading…
Cancel
Save