Daring
September 10, 2018, 9:10am
1
Tell us what’s happening:
Your code so far
function testGreaterThan(val) {
if (val > 100) { // Change this line
return "Over 100";
}
if (val > 11) { // Change this line
return "Over 10";
}
return "10 or Under";
}
// Change this value to test
testGreaterThan(101);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:62.0) Gecko/20100101 Firefox/62.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator/
You’re missing the number 11 on your condition. Guess why?
I mean, if val === 11
it will print “10 or under”.
Daring
September 10, 2018, 9:18am
3
i think … i don’t know i have tried figuring this out but i cant help it.
Let’s think of this case: testGreaterThan(11);
.
In this case, the function is returning “10 or under” and that’s because of the second if statement in your code.
Daring
September 10, 2018, 9:24am
5
okay i get it, that means i should change
this
if (val > 10) { // Change this line
return "Over 10";
}
and this one too
testGreaterThan(10);
Yep. You don’t need to change the function call (testGreaterThan(10)
), though; it’s there only for you to test your function.
Congrats! The challenge should be completed
Daring
September 10, 2018, 9:33am
7
thanks alot, much much thank’s to you
Happy coding.
1 Like