-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
61 lines (47 loc) · 1.19 KB
/
index.js
File metadata and controls
61 lines (47 loc) · 1.19 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
// function = A section of reusable code.
// Declare code once, use it whenever you want.
// Call the function to execute that code.
function happyBirthday(username,age){
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 !!`)
}
happyBirthday("BroCode", 25);
happyBirthday("SpongeBob", 30);
happyBirthday("Patrick", 35);
function add(x,y){
let result = x + y;
return result;
}
function subtract(x,y){
let result = x - y;
return result;
}
function multiply(x,y){
let result = x * y;
return result;
}
function divide(x,y){
let result = x / y;
return result;
}
function isEven(number){
return number % 2 === 0 ? true : false;
}
function isValidEmail(email){
if(email.includes("@")){
return true;
}
else {
return false;
}
}
console.log(add(10,5));
console.log(subtract(10,5));
console.log(multiply(10,5));
console.log(divide(10,5));
console.log(isEven(40));
console.log(isValidEmail("BroCode@gmail.com"))
console.log(isValidEmail("ElonMusk.com"))