-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJsNumberMathods.js
62 lines (50 loc) · 1019 Bytes
/
JsNumberMathods.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function toString0(){
let x = 123;
y=x.toString(); // returns 123 from variable x
return y;
}
function toString1(){
let x = 123;
z=(123).toString(); // returns 123 from literal 123
return z;
}
function toString2(){
let x = 123;
z=(123).toString(); // returns 123 from literal 123
return z;
}
function toExponent0(){
let x = 9.656;
y=x.toExponential(2); // returns 9.66e+0
return y;
}
function toExponent1(){
let x = 9.656;
z=x.toExponential(4); // returns 9.6560e+0
return z;
}
function toExponent2(){
let x = 9.656;
t=x.toExponential(6); // returns 9.656000e+0
return t;
}
function toFix0(){
let x = 9.656;
a=x.toFixed(0); // returns 10
return a;
}
function toFix1(){
let x = 9.656;
b=x.toFixed(2); // returns 9.66
return b;
}
function toFix2(){
let x = 9.656;
c=x.toFixed(4); // returns 9.6560
return c;
}
function toFix3(){
let x = 9.656;
d=x.toFixed(6); // returns 9.656000
return d;
}