-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (36 loc) · 817 Bytes
/
index.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
function theBeatlesPlay(musicians, instruments) {
var result = [];
for (var i = 0; i < musicians.length; i++) {
var artist = musicians[i];
for (var j = 0; j < instruments.length; j++) {
var instru = instruments[i];
}
result.push(artist + ' plays ' + instru);
}
return result;
}
function johnLennonFacts(array) {
var i = 0;
const newFacts = [];
while (i < array.length) {
var fact = `${array[i]}!!!`;
i++;
newFacts.push(fact);
}
return newFacts;
}
function iLoveTheBeatles(Number) {
var result = [];
var num = Number + 1;
if (num > 17) {
result.push('I love the Beatles!');
}
if (num <= 17) {
var i = 0;
do {
i++;
result.push('I love the Beatles!');
} while (i < num);
}
return result;
}