// Returns the number and pluralized form, like "5 cats" or "1 dog", given
// a noun and count. However, there are a few exceptions. In this exercise,
// add "es" in the following cases:
// 1. the given noun ends with 'o'. For example, '5 potatoes'.
// 2. the noun ends in "f" or "fe" change the "f" to a "v" and add "-es."
// 3. the noun ends in "y", change the "y" to a "i" and add "-es."
// HINT: to replace the last character, you can use `replace()` with Regex.
// For example, if you would like to replace the last 'e' with 'o' in a string `str`,
// you can use `str.replace(/e$/, 'o')`.
if ((count > 1) || (count < 0) || (count == 0) && slice(-1) == o$) {
result = count + " " + noun.replace(/o$/, "oe") + "s";
}
if ((count > 1) || (count < 0) || (count == 0) && slice(-1) == f$) {
result = count + " " + noun.replace(/f$/, "v") + "es";
}
if ((count > 1) || (count < 0) || (count == 0) && slice(-1) == y$) {
result = count + " " + noun.replace(/y$/, "i") + "es";
}
else(result = count + " " + noun)
// DO NOT CHANGE THIS.
console.log(result);
0 degrees
Failed
0 thieves
Failed
1 thief
Passed
1 family
Passed
2 families
Passed
1 party
Passed
1 apple
Passed
2 apples
Failed
10 balloons
Failed
1 balloon
Passed
3 knife
Failed
2 potatoes
Passed
10 tomatoes
Passed
2 parties
Passed
-40 degrees
Failed