-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumber-math.js
49 lines (34 loc) · 1.12 KB
/
number-math.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
const score = 500;
// console.log(score);
// create number type
const balance = new Number(100);
// console.log(balance);
// convert string
// console.log(balance.toString().length);
// for decimal value
// console.log(balance.toFixed(2));
/**
* toPrecision fun() retring total value based on passnumber it count include . also
*/
const number = 25.1253
// console.log(number.toPrecision(4));
/**
* toLocaleString('en-IN') fun() retrun indian standard of price
*/
const amount = 1000000
amount.toLocaleString('en-IN')
// console.log(amount.toLocaleString('en-IN'));
/** ------------------------------------------- Maths ----------------------------- */
// console.log(Math);
// console.log(Math.abs(-5));
// console.log(Math.round(8.65));
// console.log(Math.ceil(8.65));
// console.log(Math.floor(8.65));
// console.log(Math.sqrt(8));
// console.log(Math.min(8,5,8,9,4,2,3));
// console.log(Math.max(8,5,8,9,4,2,3));
console.log(Math.random()*10);
console.log((Math.random()*10) + 1);
const min = 10
const max = 20
console.log(Math.floor(Math.random() * (max - min + 1)) + min);