I am still stuck at 16


#1

Hi Jahmai,

How did you overcome your error, I am still stuck at 16 and im getting the same error message like the one you got. Can you please help and thanks in advance.


16. "It looks like your if/else statement didn't log ..."
#2

What exactly are you logging?


#3

// Remember, the order and punctuation matter.
// If you get an error, check carefully, line by line.
// If you're really stuck, click "Stuck? Get a hint!"
if(20 == 20)
{
console.log(" The answer is correct");
}
else (20 < 20)
{
console.log("The answer is wrong");
}
Please find my code above; All I know is that the problem is on the else statement but I don't seem to have an idea what the problem is.
thanks in advance.


#4

The exercise is asking you to log "The condition is false". You are not logging that in either one of your console.log statements.

It isn't logical to put a condition on else like that. else is meant to cover every other possible option that isn't covered in the if condition. Sometimes you do want to check some other options, but then you use else if -- I don't think we've come to that yet.


#5

That part I just changed it to see if it will work before I had it like this :
if(20 == 20)
{
console.log(" The answer is correct");
}
else
{
console.log("The answer is wrong");
}


#6

That's better, there are no syntax errors now. You just have to log exactly what the exercise is asking for, don't make up your own messages.


#7

I don't have a clue can you give me an example please, I was trying to go back to the previous exercise to check how I did something similar to this but I don't know how to I go back. I have been stuck here for too long. thanks in advance


#8

The exercise is asking you to print "The condition is false" when the if condition is false.
You are currently printing "The answer is wrong".

And, to get it to print that statement, you must have something false as your condition:

if( this is your condition )

This is how if/else statements work:

    if (this is true) {
        do this thing;
    } else {
        do this other thing;
    }

#9

You are very good at explaining things, I get your point clearly. unfortunately I am not winning. I don't know what to do now to pass this. Can you write one if/else statement for me hopefully it will click in my head. Thank you so much.


#10

Here is an example. If you don't understand how if/else works, go over here https://repl.it/languages/javascript and paste that code in. Then try changing the condition -- make it true, make it false. Change the console.log strings. Keep doing that until you get it.

    if (5 > 10) {
        console.log("That's true.");
    } else {
        console.log("That's false.");
    }

#12

I had the same problem and I think what you're doing is overcomplicating it.

You literally have to change two things in the whole code and it works. You don't need to change the words or anything like that. Just leave it as it is.

The hint I'll give you is that all the errors are in the first line.


#13

Hi,

My code is as below:

if(10>3)
{
console.log("The condition is true");
}
else
{
console.log("The condition is false");
}

My question is : If my condition evaluates to be true why is the text in the if statement does not get printed on the console


#15

Hi what's the message error?


#16

What do you see getting printed to the console?