Getting started with programming Conclusion lesson 28/28 part 2


#1

Hi! I am currently stuck on lesson 28 out of 28 on JS path.
Here is the code that I am using that does not seem to work. What should I do correctly to complete the course?

// Not sure where to begin? Check the Hint!
if ("exercise" < 28)
{
console.log("Yay!");
}
else
{
console.log("I have finished first course!");
}


#2

try that if ("exercise".length < 28)


#3

Thank you!

I tried that and now my line 4 of code works, but my final line which has the sentence, "I completed my first course!" does not work.
Earlier, my last line worked, but the line 4 didn't; Now they are switched!


#4

try to put a small number at the place of 28 for exanple if ("exercise".length < 2)


#5

Ok I did change it to a smaller number, but now its the same issue as before: The final line of code works, but line 4 does not show up.


#6

Only one should show up. Becaus of the if condition
"exercise".length == 8
So the if statement look like this..
If (8 <2 ){
Run this code
}
else {
OtherWise this one
}
In this case it will runner the second console.log because the condition are false


#7

Ah! Thank you!

However, I still can't move onto to complete the lessons.
Should I make the "if" statement true and then make the other statement false?


#8

the only thing the lesson aske you to do is to print this sentence
("I finished my first course!") so it should be like that.

if ("exercise".length < 28)
{
console.log("I finished my first course!");
} 
else
{ 
console.log("try again!");
}

#9

Thank you so much!
:slightly_smiling:


#10

Yeah I tried to get fancy and made a variable myName and gave it a defined length and made if/else after and it kept giving me an error. Did simple like @wizmarco said and it worked Thanks!!!


#11