forked from gocodeup/intro-to-testing-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
40 lines (34 loc) · 892 Bytes
/
code.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
// helloWorld function
function helloWorld() {
return "Hello, World!";
}
// sayHello function
function sayHello(name) {
if(typeof name === `boolean`) {
return `Hello, World!`
} else {
return `Hello, ` + name + `!`;
}
}
function isFive(input) {
return input == `5`
}
function isEven(input) {
return (input % 2 === 0) && (typeof input !== `boolean`)
}
function isVowel(input) {
if(input === `a` || input === `A` || input === `e` ||input === `E` || input === `i` || input === `I` || input === `o` || input === `O` || input === `u` || input === `U`) {
return true;
} else {
return false
}
}
function add(x , y) {
if((isNaN(x) === true) || (isNaN(y) === true)) {
return NaN;
} else {
return parseInt(x) + parseInt(y);
}
}
console.log(add(`banana`,`split`));
console.log(typeof (`NaN`,4));