-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
81 lines (81 loc) · 2.07 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
console.log(Math.floor(Math.random() * 6) +1);
function oddoreven(num){return num %2 == 0 ? "even": "odd";}
console.log(oddoreven(44));
let num1 = "1234"
let num2 = parseInt(num1, 10)
console.log(num2);
let num3 = "123.654";
let num4 = parseFloat(num3);
console.log(num4);
let szn = 6757.8765;
let sxy = Math.floor(szn);
console.log(sxy);
console.log(Math.max(1, 2, 5 ,7));
console.log(Math.min(8,6,5,-2));
let kid = 18
kid > 16 ? console.log("yes"):console.log("no");
console.log(num3.length);
console.log(num1[0]);
console.log(num1.substring(1,4));
let sad = "ahmed";
console.log(sad.toUpperCase());
console.log(sad.includes("t"));
let de = sad.substring(sad.length -2);
console.log(de);
let dsa = sad.slice(4);
console.log(dsa);
console.log(1 == 2 ? "yes": "no");
function sum(x, z){return z - x;}
isNaN(num1) ? console.log("yes"): console.log("no");
let name= "ahmed";
let age = 39;
let aboutme = ` my name is ${name}, i am ${age}.`;
console.log(aboutme);
let x,z,t;
x = 2;
z = 7
t = x + z;
console.log(t);
let stre = true;
let a = 4;
console.log(a--);
let cxy = " afghj";
let numa ="65544";
console.log(parseInt(numa));
let bvc = 12.7;
let bvc1 = "12";
console.log(bvc === bvc1 ? "r": "n");
console.log(3.6 ? "z": "r");
console.log(Math.floor(Math.random() *10) + 1);
console.log(parseFloat(bvc));
console.log(Math.floor(Math.random() * 5) +1);
let uname = "nanbbaa";
console.log(uname);
console.log(uname.toUpperCase());
let uname1 = uname.substring(1).toLocaleUpperCase();
console.log(uname1);
let uname2 = uname.substring(uname.length -3).toUpperCase();
console.log(uname2);
let o,y,u;
o= 7
y = 8
u = x + y;
console.log((x*y)/(5+55)*u);
let f = false;
let r = 44;
console.log(r+f);
let numas = 0.1;
let numas1 = 0.2;
let res = numas + numas1;
console.log(res);
console.log(res.toFixed(4));
console.log(1+1 == 2);
console.log(1+1 != 3);
console.log(1+1 == 2 || 1+2 == 4);
function print(str){console.log(str);}
print("sad");
print(30);
function sum(x, y){ z = x + z; return z;}
console.log(sum(6, 7));
function roundup(num){let result = Math.ceil(num); console.log(result);}
console.log(roundup(55435.65));