Conclusion pt 2


#1

For this part I ended up passing it by myself, but I am kinda confused on why. I wrote my code
var myColor = "Orange";
if ("var myColor" .length === 3)
{
console.log ("I finished my first course!")
}
else myColor
{
console.log ("I didn't finish my first course!")
}

This was my first code and it didn't work for some reason (i am trying to get the first console.log to input.) It inputted the 2nd console.log. So i tried switching it around (the two console.log sentences) and it worked. But I am kinda confused why it worked this way and not the first way. I have a feeling it is a problem with my 2nd line but I am not entirely sure.


#2

This should not have passed.

if (myColor.length === 3) {

}

Remember to never write a variable enclosed in quotes. That makes it a string literal, not a variable. Anything is quotes is string text.


#3

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