-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05five.js
86 lines (73 loc) · 1.31 KB
/
05five.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
82
83
84
85
86
//Task1
function evenOdd(num) {
if (num % 2 == 0) {
console.log("Number is even");
} else {
console.log("Number is odd");
}
};
evenOdd(5);
//Task2
function square(num) {
return res=num*num;
};
console.log(square(6));
//Task 3
const max=function(num1,num2){
if(num1>num2){
return num1;
}else{
return num2;
}
}
console.log(max(8,2),"is Maximum");
//Task 4
const concat=function(str1,str2){
return str1+str2;
}
console.log(concat("Tejas","Dherange"));
//Task 5
const sum=(num1,num2)=>{
return num1+num2;
}
console.log(sum(2,9));
//Task 6
const specific=(str)=>{
return str.includes("e")
}
console.log(specific("Tejas"));
//Task 7
const def=function(num1,num2=8){
return num1*num2;
}
console.log(def(5,9));
console.log(def(5));
//Task 8
const greet=function(name,age=18){
return `Hello ${name} , you are ${age} !`
}
console.log(greet("Tejas"));
console.log(greet("Tejas",20));
//Task 9
const higher=function(lower,num){
return lower()+num;
}
const lower=function(){
return 9;
}
console.log(higher(lower,5));
//Task 10
function higher1(f1,f2){
return function(value){
return f2(f1(value));
}
}
function add(n){
return n+10;
}
function multy(n){
return n*3;
}
const addmulty=higher1(add,multy);
const res1=addmulty(6);
console.log(res1);