-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
51 lines (45 loc) · 1.08 KB
/
Copy pathfunctions.js
File metadata and controls
51 lines (45 loc) · 1.08 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
// function = A section of reusable ocde.
// Declare code once, use it whenever you want.
// Call the function to execute that code.
/*
function hbd(username, age) { // parameters
console.log("Happy Birthday to you");
console.log("Happy Birthday to you");
console.log(`Happy Birthday dear ${username}`);
console.log("Happy Birthday to you");
console.log(`You are ${age} years old`);
}
hbd("Rishaan", 19);
hbd("Piku", 20);
hbd("Bhola", 21);
*/
function add(x, y){
let result= x + y;
return result;
}
function subtract(x, y){
return x - y;
}
function multiply(x, y){
return x * y;
}
function division(x, y){
return x / y;
}
function isEven(number){
if(number % 2 === 0) { // return number % 2 === 0? true: false;
return true;
}
else{
return false;
}
}
function isValidEmail(email){
return email.includes("@")? true : false;
}
console.log(add(2, 3));
console.log(subtract(5, 3));
console.log(multiply(2, 3));
console.log(division(2, 3));
console.log(isEven(9));
console.log(isValidEmail("rishaan@gmail.com"));