-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem27.js
More file actions
37 lines (24 loc) · 678 Bytes
/
problem27.js
File metadata and controls
37 lines (24 loc) · 678 Bytes
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
/* Write a function called odd_even() which takes an integer value and tells whether this value is even or odd. You need to do it in 4 ways:
- Has return + Has parameter
- No return + Has parameter */
// Has return+ Has parameter
function odd_even(num){
if(num % 2 == 0){
return num + " is an even number.";
}
else{
return num + " is an odd number.";
}
};
var randomNum = odd_even(16);
console.log(randomNum);
// No return + Has parameter
function odd_even(num){
if( num % 2 == 0){
console.log(num, " is an Even number.");
}
else{
console.log(num, " is an Odd number.");
}
}
odd_even(50);