true or falseNow inspect this function:
function isPassing(score) {
return score > 60;
}
score > 60 is a comparison. It returns true when the score is greater than 60, otherwise false.
But the requirement says: numeric scores of 60 or higher pass.
So predict these results:
| Input | score > 60 result |
|---|---|
59 |
false |
60 |
false |
61 |
true |
That means the function is wrong at the boundary value 60. It excludes 60, even though 60 should pass.
>= means greater than or equal to. > means strictly greater than, so it leaves out exactly 60.
The fix is one character:
function isPassing(score) {
return score >= 60;
}
Now the worked results match the requirement:
isPassing(59) → falseisPassing(60) → trueisPassing(61) → trueThis is a classic code-reading move: compare the code to the requirement, then test the edge case where the wording changes.
Why is the original isPassing(score) { return score > 60; } incorrect for the stated requirement?
The requirement is '60 or higher pass,' so exactly 60 must return true. The answer about 59 is tempting if you know there is a bug but haven’t traced the actual values; 59 > 60 is false, which is correct. The answer about returning a number mistakes a boolean function for a numeric one. The answer about checking below 100 introduces a rule this function does not contain at all.