Computers aren't that smart


#1

I can't figure out the error on this problem? where do I start?

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

Replace this line with your code.


#2

what's the problem with my syntax?


#3

what is the first 10 for in each condition? can you post a screen shot of problem set or link to it?


#4

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


#5

I think I figured it out. I needed to make the equal sign like this: === instead of just =


#6

also, no semicolon after if or else


#7

this doesn't make sense here at all, the excercise shouldn't have let you pass with the changes you said you made above

Was this what you were trying to do?

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

You can't try and compare anything in the else section, it's the default value the loop will refer to if the answer is not true.


#8

Syntax:

if (condition1) {
block of code to be executed if condition1 is true
} else if (condition2) {
block of code to be executed if the condition1 is false and condition2 is true
} else {
block of code to be executed if the condition1 is false and condition2 is false
}

if ("zoey".length 10 = 10); { // you have to remove ;
console.log ("You got a true!");
} else ("zoey".length 10 < 8); { same you have to remove ;
console.log ("You got a false!");
// now you have to close ( } )

you are given

if (10 = 10); { // remove ; and write == instead of =
console.log("You got a true!");
} else {
console.log("You got a false!");
}

note:
Assignment =
Equality ==


#9

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