An typo in a code description - 'if' statement, closed interval
See original GitHub issueChallenge Comparisons with the Logical And Operator has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; rv:11.0) like Gecko
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
In this Challenge, there is a part concerning an if statement:
I think there is a mistake in a description of logic behind this code snippet as this if statement will return “Yes” if num is between 5 and 10 (5 and 10 excluded). According to your description, any number in a range (5, 6) and (9, 10) will return false, but it is not true.
My code:
function testLogicalAnd(val) {
// Only change code below this line
if (val >= 25 && val <= 50) {
return "Yes";
}
// Only change code above this line
return "No";
}
// Change this value to test
testLogicalAnd(25.001);
As you can see, this value is causing a function to return true, which is correct.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (8 by maintainers)
Top GitHub Comments
@raisedadead Yes, I agree 100%. Are pull requests restricted only to those who create an issue, or just anybody, who’s faster? I can submit a change today, if you don’t mind.
@gczarnocki I already started writing this for first-timers, but if that’s you, go for it:
To fix this, in seed/challenges/01-front-end-development-certification/basic-javascript.json
change the line:
will only return \"Yes\" if <code>num</code> is between <code>6</code> and <code>9</code> (6 and 9 included).
to:
will only return \"Yes"\ if <code>num</code> is greater than <code>5</code> and less than <code>10</code>.