28. Conclusion Part 2, what am i doing wrong?


#1

what i did:

if( 15 > 10 )
{ "I finished my first course!" }
else { "I suck at coding!" }

the log gives me "I finished my first course!"
but instead of saying move on to next lesson it says "oops, try again! Look like you didn't log anything!"
what am I doing wrong?


#2

@parkerbeck_,
did you try...

++++ reset of session *****************
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#3

thanks for the reply!

I tried resetting both ways and its still giving me the "Oops!" message :frowning:

also tried:

var myAge = "19";
if ( myAge > 2 ) {
"I finished my course!" }
else {
"I suck at coding!" }

from a blank log, it again gave me the 'true' result but I again get the error message. Don't know what's going on ...


#4

instead of

if (myAge> 2) {"I finished my course!"}

and

 else { "I suck at coding" }

try

if (myAge > 2) { console.log("I finished my course!")

and

else { console.log("I suck at coding")
}

in other words, you are forgetting your console.logs.
the reason why the console is printing true is because what you typed is true but it doesn't recognize your strings because there is no console.log :grinning:


#5

@parkerbeck_,
maybe if included the console.log()-method
like

console.log("I finished my course!");

and

console.log("I suck at coding!");

#6

Yes that was the problem! The console.log made it work!
Okay yeah that makes sense, thanks for all your help :smile:


#7

I'm getting this same error but even if I try the fixes listed here it still isn't working. Any suggestions?


#8

@andybussell,
Please display the code you are currently using...


#9

Please help :frowning:

var myName="Chanel";
if ("myName".length>2) {
console.log("I finished my course!");
}
else {
console.log("I am here forever");
}


#10

@sweaty42,

As soon as you have assigned a VALUE to a variable name
like in

var myName = "Chanel";

you will be able to use this variable-name
in your code
and the Javascript Interpreter will evaluate the variable-name into the associated VALUE.

Thus you could have used

if ( myName.length > 2 ) {
     console.log("I finished my course!");
} else {
 console.log("I am here forever");
}

#11

var myName=dany
dany=4;
if(myName===4)
{console.log("i finished my first course");
}
else{("nop");}


#12

@itacamba

I'm not sure if "VAR (add a var at the beginning to define it) dany = 4" has to be in front of "var myName = dany".

Also, it should be "CONSOLE.LOG("nop");".


#14

I copy your answer, but it's still wrong


#15

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