dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.9 KiB
1.9 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 69738771fb5a7b8b24cca2a2 | Challenge 176: Groundhog Day | 28 | challenge-176 |
--description--
Today is Groundhog Day, in which a groundhog predicts the weather based on whether or not it sees its shadow.
Given a value representing the groundhog's appearance, return the correct prediction:
- If the given value is the boolean
true(the groundhog saw its shadow), return"Looks like we'll have six more weeks of winter.". - If the value is the boolean
false(the groundhog did not see its shadow), return"It's going to be an early spring.". - If the value is anything else (the groundhog did not show up), return
"No prediction this year.".
--hints--
groundhogDayPrediction(true) should return "Looks like we'll have six more weeks of winter.".
assert.equal(groundhogDayPrediction(true), "Looks like we'll have six more weeks of winter.");
groundhogDayPrediction(false) should return "It's going to be an early spring.".
assert.equal(groundhogDayPrediction(false), "It's going to be an early spring.");
groundhogDayPrediction(null) should return "No prediction this year.".
assert.equal(groundhogDayPrediction(null), "No prediction this year.");
groundhogDayPrediction(" ") should return "No prediction this year.".
assert.equal(groundhogDayPrediction(" "), "No prediction this year.");
groundhogDayPrediction("true") should return "No prediction this year.".
assert.equal(groundhogDayPrediction("true"), "No prediction this year.");
--seed--
--seed-contents--
function groundhogDayPrediction(appearance) {
return appearance;
}
--solutions--
function groundhogDayPrediction(appearance) {
if (appearance === true) return "Looks like we'll have six more weeks of winter.";
if (appearance === false) return "It's going to be an early spring.";
return "No prediction this year.";
}