You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*You have an award-winning garden and every day the plants need exactly 40mm of water. You created a great piece of JavaScript to calculate the amount of water your plants will need when you have taken into consideration the amount of rain water that is forecast for the day. Your jealous neighbour hacked your computer and filled your code with bugs.
Your task is to debug the code before your plants die!*/
function rainAmount(mm) {
if (mm < 40) {
return "You need to give your plant " + (40 - mm) + "mm of water"
} else {
return "Your plant has had more than enough water for today!"
}
}
function rainAmount(mm) {
return mm < 40 ? `You need to give your plant ${40 - mm}mm of water`: "Your plant has had more than enough water for today!"