JavaScript #19 it says: "Ops, tente outra vez. Make sure your if/else statement evaluates to true! ". Help me, please


#1

:flushed:http://discuss-cdn.codecademy.com/images/emoji/emoji_one/flushed.png?v=0


#2

show us your code... Not an image @julia_programmer..


#3

if ("Jon".length * 2 / (2+1) === 2) {
console.log("the condition is true");
}
else {
console.log("Error Error Error");
}


#4

Ok so that code evaluates to true since the length of "Jon" is 3, and when you multiply that by 2 it gives you 6. Then when you divide that by 2+1 or 3 it gives you 2. Whitch is equal to 2. Whitch runs the if statement not else. If you want the else statement to run just change it to the not equal to sign like this:
This is your orignal code:

To make it go false:

if ("Jon".length * 2 / (2+1) != 2) {

Hope that helped! If it didnt please reply stating what exactly your problem is, and ill help you out!


#5

no, it didn't. before I change my code as you suggested on black screen was:"the condition is true", now:"Error Error Error" and the same ops


#6

@julia_programmer Wow that is a bug. Ima make the mods take a look at this:


#7

so, what should I do here?


#8

Wait until a mod arrives... Nvm ima invite all the mods here just a second


#9

Help, anybody, help, if u please?


#10

@mtf @albionsrefuge @Zystvan


#11

Ok invited every mod here.


#12

..That's a bit dangerous... They might eat you alive!


#13

if ("Jon".length * 2 / (2+1) === 2) {
console.log("the condition is true");
}
else {
console.log("Error Error Error");
}


#14

@julia_programmer the message you are printing when he loop evaluates to true isnt what was originally given try not to change it

 console.log("The answer makes sense!");

#15

I didn't see that. good spot!

It's OK mods, the problem has been solved, go back to whatever you were doing!

:wink:


#16

I've got it like this


How am I supposed to write it?


#17

I had to go into codeacademy to check what was wrong because that code works


#18

Seriously Codecademy should improve on that. We should be able to type anything there. But the main goal of the program should be so we evaluate true.

:scream:


#19

thank u rydan :grinning:


#20

you should have

if ("Jon".length * 2 / (2+1) === 2)

but you don't have that