-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass4.js
More file actions
72 lines (49 loc) · 1.31 KB
/
class4.js
File metadata and controls
72 lines (49 loc) · 1.31 KB
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
63
64
65
66
67
68
69
70
71
72
// constain in js
let radius =10;
const pi = 3.14; //we cannot changed
let area = pi*radius*radius;
// console.log(area);
// some practice on datatypes
let num = 5554565745544887;
let num2 = 5/0;// infinity
let num3 = -4/0;
console.log(num3);
//min value and max value
let min = Number.MIN_VALUE;
let max = Number.MAX_VALUE;
console.log(min+" "+max*10)//5e-324 Infinity
// Bigint
let num4 = 46464564616165156513232n;
console.log(num4 + 2n);
//string
let firstName = "Deepesh";
let lastName = "Ahirwar";
let merge = firstName +" "+ lastName ;
let s1 ="rah\nul"
console.log(s1);
// boolean
let bool = 5 < 6;
console.log(bool);
// string conversion
// number to string
let num5 = String(4);
console.log(num5 , typeof num5);
// string to number
let num7 = Number("123");
console.log(num7 , typeof num7);
// coercion
let x ;
console.log(x, typeof x);
x = 12;
console.log(x, typeof x);
x = x+ "";
console.log(x, typeof x);
x = x-2;
console.log(x, typeof x);
x = !x;
console.log(x, typeof x);
// 0 = false
// 1 to infinity all number give = true
console.log(Boolean(0));//false
console.log(Boolean(1)); //true
console.log(Boolean(20));//true