Hi @cazzimoto! This works as expected, so well done! I do feel a little bit funny having the switch
statement before the machineResult
assignment, as surely it should check the machine is on first and deliver the result of that, before then checking the password. But given the way browsers handle conditionals, it works anyway
A minor nitpick is that in the instructions, it says " We’d like you to do this in a single line, using something that isn’t an if ... else
structure."
A switch statement isn’t a single line The above line was supposed to hint at using a ternary operator to do this (?
). Check out our solution at https://github.com/mdn/learning-area/blob/master/javascript/building-blocks/tasks/conditionals/marking.md#task-4