All challenges
ProgrammingDebugBeginner5 min
Fix the weekend check
Skills: Debugging · Boolean expressions
Task
isWeekend(day) should return true for "Saturday" and "Sunday", and false for every other day. Day names are written with a capital first letter. Fix the condition.What goes wrong
isWeekend("Saturday") returns false, and so does every other day.Examples
Run examples tries these. Check solution also runs 3 more tests.
- Saturday is a weekend dayExample
- Call
- isWeekend("Saturday")
- Expected
- Returns true
- Monday is notExample
- Call
- isWeekend("Monday")
- Expected
- Returns false
Every test, including the extra ones, is part of this page. Nothing is hidden or secret.
Your code
Loading the editor…
function isWeekend(day) {
return day === "Saturday" && day === "Sunday";
}
Ctrl + Enter (⌘ + Enter on a Mac) runs the examples; add Shift to check. Tab indents; press Esc, then Tab, to leave the editor.
Run examples tries your code on the examples and records nothing. Check solution runs every test and saves an attempt.
Tests
Run your code to see which tests pass.
Console
What your code logs with console.log appears here.