1abs(x) Returns the absolute value of x
2acos(x) Returns the arccosine of x, in radians
3acosh(x) Returns the hyperbolic arccosine of x
4asin(x) Returns the arcsine of x, in radians
5asinh(x) Returns the hyperbolic arcsine of x
6atan(x) Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians
7atan2(y, x) Returns the arctangent of the quotient of its arguments
8atanh(x) Returns the hyperbolic arctangent of x
9cbrt(x) Returns the cubic root of x
10ceil(x) Returns x, rounded upwards to the nearest integer
11cos(x) Returns the cosine of x (x is in radians)
12cosh(x) Returns the hyperbolic cosine of x
13exp(x) Returns the value of Ex
14floor(x) Returns x, rounded downwards to the nearest integer
15log(x) Returns the natural logarithm (base E) of x
16max(x, y, z, ..., n) Returns the number with the highest value
17min(x, y, z, ..., n) Returns the number with the lowest value
18pow(x, y) Returns the value of x to the power of y
19random() Returns a random number between 0 and 1
20round(x) Rounds x to the nearest integer
21sin(x) Returns the sine of x (x is in radians)
22sinh(x) Returns the hyperbolic sine of x
23sqrt(x) Returns the square root of x
24tan(x) Returns the tangent of an angle
25tanh(x) Returns the hyperbolic tangent of a number
26trunc(x) Returns the integer part of a number (x)
1E: 2.718281828459045
2LN2: 0.6931471805599453
3LN10: 2.302585092994046
4LOG2E: 1.4426950408889634
5LOG10E: 0.4342944819032518
6PI: 3.141592653589793
7SQRT1_2: 0.7071067811865476
8SQRT2: 1.4142135623730951
9abs: ƒ abs()
10acos: ƒ acos()
11acosh: ƒ acosh()
12asin: ƒ asin()
13asinh: ƒ asinh()
14atan: ƒ atan()
15atan2: ƒ atan2()
16atanh: ƒ atanh()
17cbrt: ƒ cbrt()
18ceil: ƒ ceil()
19clz32: ƒ clz32()
20cos: ƒ cos()
21cosh: ƒ cosh()
22exp: ƒ exp()
23expm1: ƒ expm1()
24floor: ƒ floor()
25fround: ƒ fround()
26hypot: ƒ hypot()
27imul: ƒ imul()
28log: ƒ log()
29log1p: ƒ log1p()
30log2: ƒ log2()
31log10: ƒ log10()
32max: ƒ max()
33min: ƒ min()
34pow: ƒ pow()
35random: ƒ random()
36round: ƒ round()
37sign: ƒ sign()
38sin: ƒ sin()
39sinh: ƒ sinh()
40sqrt: ƒ sqrt()
41tan: ƒ tan()
42tanh: ƒ tanh()
43trunc: ƒ trunc()
44Symbol(Symbol.toStringTag): "Math"
45__proto__: Object
1//Math in JS is similar and different to the one in real life
2//Like: "+", "-" signs are the same. But "X" and "÷" are replaced with "*" and "/" respectivly
3//You can do math both with variables and normal numbers
4________________________________________________________________________________
5 Normal Number Examples
6
74+4 = 8;
84-4 = 0;
94*4 = 16;
104/4 = 1;
11________________________________________________________________________________
12 Variable Examples
13
14num1 = 0;
15num2 = 0;
16ans = 0;
17
18num1 = 4;
19num2 = 64
20
21num1 + num2 = 68
22num1 - num2 = 60
23num1 * num2 = 24
24num1 / num2 = 256;
25
26num1 + num2 = ans;
27num1 - num2 = ans;
28num1 * num2 = ans;
29num1 / num2 = ans;
30________________________________________________________________________________
31Now, you can use the document.getElementByID("").innerHTML = ans; to set the answer
32
33
34
35//I hope this post helped you!
1
2Math.round(4.9); // returns 5
3
4Math.round(4.7); // returns 5
5
6Math.round(4.4); // returns 4
7
8Math.round(4.2); // returns 4
9
10Math.round(-4.2); // returns -4
11
12
1
2Math.ceil(4.9); // returns 5
3
4Math.ceil(4.7); // returns 5
5
6Math.ceil(4.4); // returns 5
7
8Math.ceil(4.2); // returns 5
9
10Math.ceil(-4.2); // returns -4
11
12
1math in Javascript
2// finding absolute value of a number
3var number = -8;
4let output = Math.abs(number);
5console.log(output);
6
7var num =6;
8nums = Math.abs(num);
9console.log(nums);
10
11// finding ceil(khali upre di tanbo) of a number
12var mynumber = 9.59;
13let myceil = Math.ceil(mynumber);
14console.log(myceil);
15
16// finding floor (kacher nichor shonka tanbo) of a number
17var yournumber = 9.59;
18let yourfloor = Math.floor(yournumber);
19console.log(yourfloor);
20
21// finding round of a number
22var myround = 9.59;
23let round = Math.round(myround)
24console.log(round);
25
26//finding a random number
27var outputs = Math.random()*8;
28outputs = Math.floor(outputs)
29console.log(outputs);
30
31// making it on a for loop
32
33for( let i=0; i<=20; i++){
34 var outputs = Math.random()*8;
35outputs = Math.floor(outputs)
36console.log(outputs);
37}
38// github - redowanrafy707