Tell us what’s happening:
Hello everyone,
I’m having some issue with what I’m doing wrong in this code. Initially I had, the values swapped (val >= 25 && val >= 50) and it wasn’t passing. I saw that in the console.log on the bottom it has an arrow pointing to the 10; portion so I tried changing that value to the different test values in the problem. It didn’t do anything. Finally I looked up the problem and entered it exactly like the solution and I’m still stuck.
Any ideas what I’m doing wrong?
Your code so far
function testLogicalAnd(val) {
// Only change code below this line
if (val <= 50 && val >= 25) {
// Only change code above this line
return "No";
}
testLogicalAnd(10);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0.
Challenge: Comparisons with the Logical And Operator
Thank you both for pointing that out. I must have somehow omitted that and totally didn’t see the syntax error. I went ahead and added a } after return “No”;
but no luck on getting it to actually give me a yes or no.
function testLogicalAnd(val) {
// Only change code below this line
if (val <= 50 && val >= 25) {
return "Yes";
// Only change code above this line
return "No";
}
}
testLogicalAnd(10);
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Thank you! That did the trick! Can’t believe I missed that I will make note of the backticks.
function testLogicalAnd(val) {
// Only change code below this line
if (val <= 50 && val >= 25) {
return "Yes";
}
// Only change code above this line
return "No";
}
testLogicalAnd(10);