-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchih.js
More file actions
102 lines (69 loc) · 1.43 KB
/
Copy pathchih.js
File metadata and controls
102 lines (69 loc) · 1.43 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
let x= 20
let y = 30
let z = x+y
let d = z*2
console.log(d)
let f =130
let r = f % 10
let w = r+ f
console.log(w)
let a = 20
let n = 3
let i = a * n
console.log(i)
let o = 100
let q = o + 10
let p = o % 10
let t= o - 10
q = 4
t = 2
p = 7
let u = q*t*p
let g = o/u
console.log(u)
console.log(g)
let number = 5;
let result = (number> 2)? true: false;
console.log(result);
let left_operand = 50
let right_operand = 30
let operator = "/"
if(operator == "+"){
console.log(left_operand+ right_operand)
}else if(operator == "-"){
console.log(left_operand -right_operand)
}else if(operator == "*"){
console.log(left_operand *right_operand)
}else if(operator == "/"){
console.log(left_operand /right_operand)
}
let ans = console
using function
function calc(x){
function secondNumber(a){
return a*x;
}
return secondNumber;
}
console.log(calc(3)(2));
const calc = function(x){
function secondNumber(a){
return a*x;
}
return secondNumber;
}
console.log(calc(3)(2));
function higherOrderFunction(func){
console.log("higher functon")
func();
}
function lowerOrderFunction(){
console.log("lower function")
}
higherOrderFunction(lowerOrderFunction);
function greetings(greet){
return function person(name){
return `Hello, ${name}.${greet}`;
}
}
console.log(greetings("Good morning!")("john"))