Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions 02_Day_Data_types/02_day_data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,26 @@
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:

1. Objects
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:**

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down