pull/886/merge
Raphael De Los Reyes 4 months ago committed by GitHub
commit 354b5908cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -57,12 +57,12 @@ In the previous section, we mentioned a little bit about data types. Data or val
Primitive data types in JavaScript include: Primitive data types in JavaScript include:
1. Numbers - Integers, floats 1. Numbers - integers, floats
2. Strings - Any data under single quote, double quote or backtick quote 2. Strings - any data under single quote, double quote or backtick quote
3. Booleans - true or false value 3. Booleans - true or false value
4. Null - empty value or no value 4. Null - empty value or no value
5. Undefined - a declared variable without a 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: Non-primitive data types in JavaScript includes:
@ -191,7 +191,7 @@ const PI = Math.PI
console.log(PI) // 3.141592653589793 console.log(PI) // 3.141592653589793
// Rounding to the closest number // 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 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.LN2) // 0.6931471805599453
console.log(Math.LN10) // 2.302585092994046 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(0)
Math.sin(60) Math.sin(1.05)
Math.cos(0) Math.cos(0)
Math.cos(60) Math.cos(1.05)
``` ```
#### Random Number Generator #### Random Number Generator

Loading…
Cancel
Save