Didn't log in the console...but it did though


#1


On part 17 Computers Aren't That Smart we are working on the if/else syntax rules.


Seems like my code is correct as far as I know and it indeed shows the result in the results editor but still gives the error code: "Oops, try again. It looks like your if/else didn't log 'You got a true!' to the console."


if (10 <= 10) {
    console.log="You got a true!";
} else {
    console.log="You got a false!";
}


#2

Use console.log() to log messages to the console.

Put the messages in the parentheses, like so:
console.log("You got a true!");


#4

Same thing. "You got a true!" IS in the console, but the error says it's not

if (10 - 1 == 9) 
{
    console.log=("You got a true!");
} 
else 
{
    console.log=("You got a false!");
}

#5

Correct syntax:

console.log("You got a true!");

Wrong syntax:

console.log=("You got a true!");

#6

Remove "="

console.log() is a command. You cannot use it as a variable.


#7

brings this error "TypeError: console.log is not a function"


#8

bring this error "TypeError: console.log is not a function"


#9

Could you please post your updated code?


#10

Please remove the assignment operator "="


#11

if (10 - 1 == 9) 
{
    console.log("You got a true!");
} 
else 
{
    console.log("You got a false!");
}

#12

That syntax is no good, though. Error reads "ReferenceError: Invalid left-hand side in assignment"
Need to equal it to something


#13

Try to change statement, instead 10 - 1 == 9 try:

if (10 == 10)

If it doesn't help, try to use 'Reset code' and pass this lesson once more. But in this time use correct syntax for console,.log() method.


#14

it says to fix that with this error: "Oops, try again. A single '=' is for assignment and '===' is for comparisons. Change the '=' to '===' in the if statement on line 8."


#15

I think should be:

if (10 === 10) {
    console.log("You got a true!");
} else {
    console.log("You got a false!");
}

#16

I think so as well. I also think codecademy has a bug or something. Brings this error: "TypeError: console.log is not a function"


#17

Try to refresh browser or use 'Reset code'. Sometimes I also have the same ptoblems and it always help me.


#18

That worked. Thank you


#19

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.