Closed odv closed 5 years ago
function leo(oscar) {
if (typeof oscar === "number" && oscar == 88) {
return "Leo finally won the oscar! Leo is happy";
} else if (oscar === 86) {
return "Not even for Wolf of wallstreet?!";
} else if (oscar != 88 && oscar < 88) {
return "When will you give Leo an Oscar?";
} else if (oscar != 86 && oscar < 88) {
return "When will you give Leo an Oscar?";
} else {
return "Leo got one already!";
}
}
@RazvanBugoi Why do you use typeof in the first if statement?
I forgot to delete it. It is there from my first attempt.
function leo(oscar) {
if (oscar === 88) {
return "Leo finally won the oscar! Leo is happy";
} else if (oscar === 86) {
return "Not even for Wolf of wallstreet?!";
} else if (oscar != 88 && oscar < 88) {
return "When will you give Leo an Oscar?";
} else if (oscar != 86 && oscar < 88) {
return "When will you give Leo an Oscar?";
} else {
return "Leo got one already!";
}
}
https://www.codewars.com/kata/leonardo-dicaprio-and-oscars/train/javascript
@RazvanBugoi Read the text of the problem very carefully.