Exercise 15 save and submit allowed regardless of answer reset



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!");
    // What should we do if the condition is false? Fill in here:
    console.log("let's drive off the shoulder ahhhhhh");


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.


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.


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


So,how did you pass [exercise 15?]


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