-
Notifications
You must be signed in to change notification settings - Fork 0
/
day5.js
63 lines (53 loc) · 1.25 KB
/
day5.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
function oddAndEvenCheck(num1){
if(num1%2==0){
console.log(`${num1} is a even number`)
}
else console.log(`${num1} is a odd number`)
}
oddAndEvenCheck(2)
function sqaure(num){
console.log(`Sqaure of ${num} : ${num*num}`)
}
sqaure(2)
function max(num1,num2){
if(num1>num2) console.log(`Max of ${num1} & ${num2} : ${num1}`)
else console.log(`Max of ${num1} & ${num2} : ${num2}`)
}
max(4,5)
function stringAdd(s1,s2){
console.log(s1+s2);
}
stringAdd("Chandan ","Sahoo")
let add = (num1,num2)=>{
console.log(`Sum of ${num1} & ${num2} : ${num1+num2}`)
}
add(10,1)
let charCheck =(s,char)=>{
for(let i=0;i<s.length;i++){
if(s[i]==char) return true;
}
return false;
}
console.log (charCheck("Chandan",'a'))
console.log(charCheck("Chandan",'e'))
function product(num1, num2=11){
console.log(`Product of ${num1} & ${num2} : ${num1*num2}`)
}
product(1)
function greeting (name,age=18){
console.log(`Hello, ${name}`)
}
greeting("Chandan")
function callByNumber(fn1,num){
while(num>0){
fn1("Chandan")
num--;
}
}
callByNumber(greeting,5)
const sqaure2= num => num*num
const cube= num => num*num*num
function mismatch(fn1,fn2,num){
return fn2(fn1(num))
}
console.log(mismatch(sqaure2,cube,2))