-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI-love-you.js
More file actions
30 lines (26 loc) · 811 Bytes
/
I-love-you.js
File metadata and controls
30 lines (26 loc) · 811 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
/*
Who remembers back to their time in the schoolyard, when girls would take a flower and tear its petals, saying each of the following phrases each time a petal was torn:
I love you
a little
a lot
passionately
madly
not at all
When the last petal was torn there were cries of excitement, dreams, surging thoughts and emotions.
Your goal in this kata is to determine which phrase the girls would say for a flower of a given number of petals, where nb_petals > 0.
*/
function howMuchILoveYou(nbPetals){
if(nbPetals%6 == 1){
return ("I love you");
}else if(nbPetals%6 == 2){
return ("a little");
}else if(nbPetals%6 ==3){
return ("a lot");
}else if(nbPetals%6 ==4){
return ("passionately");
}else if(nbPetals%6 == 5){
return ("madly");
}else{
return ("not at all");
}
}