Exercise 15 save and submit allowed regardless of answer reset


#1



https://www.codecademy.com/courses/getting-started-v2/2/4?curriculum_id=506324b3a7dffd00020bf661


Just wondering why I'm allowed to save and submit this lesson when I change the less than sign to a greater than.


if ("Which road shall we take?".length < 1 ) 
{
    console.log("Let's go down the first road!");
}
else 
{
    // What should we do if the condition is false? Fill in here:
    console.log("let's drive off the shoulder ahhhhhh");
}


#2

Well, if you change it to a greater than sign, then it runs the code inside the if statement. Why? Because if the length the of your sentence is > than 1, it will print whatever is inside the brackets of the if statement. If you change it to a less than sign, then same thing, only reversed. If the length if your sentence is < than 1(which it's not), then the if statement is false, and it will go on and print whatever is in the else statement brackets.


#3

But why am I able to save and submit when the point of the lesson is to trigger the else statement? If using a greater than sign proves the if, the execution of the else isn't achieved and shouldn't allow you to complete the exercise.


#4

It's a bug. Happens to me all the time. But as long as you understand the code and the lesson, You are fine.


#5

So,how did you pass [exercise 15?]


#7

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