-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmathFunc.js
37 lines (24 loc) · 1001 Bytes
/
mathFunc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
console.log(Math.PI); // 3.141592653589793
console.log(Math.round(5.7)); // 6
console.log(Math.round(5.4)); // 5
console.log(Math.pow(9, 2)); // 81
console.log(Math.sqrt(81)); // 9
console.log(Math.abs(-5.7)); // 5.7
console.log(Math.ceil(5.4)); // 6
console.log(Math.floor(6.7)); // 6
console.log(Math.sin((90 * Math.PI) / 180)); // 1
console.log(Math.cos((0 * Math.PI) / 180)); // 1
console.log(Math.min(0, 900, 150, 30, 20, -8, -200)); // -200
console.log(Math.max(0, 900, 150, 30, 20, -8, -200)); // 900
console.log(Math.random()); // returns a random number
// Math Properties (Constants)
/**
* Math.E // returns Euler's number
* Math.PI // returns PI
* Math.SQRT2 // returns the square root of 2
* Math.SQRT1_2 // returns the square root of 1/2
* Math.LN2 // returns the natural logarithm of 2
* Math.LN10 // returns the natural logarithm of 10
* Math.LOG2E // returns base 2 logarithm of E
* Math.LOG10E // returns base 10 logarithm of E
*/