Open ghost opened 6 years ago
use let
instead of var
actually i think its the code up above it in the hall buttons presses, you use the elevator variable, that will only be the last elevator from the loop below setting it. changing it to a let would just make elevator above undefined and throw an exception
With the following code below:
I'm just learning everything right now - but to my understanding this should configure each of the elevators. However, it only seems to ever work with the final elevator in the array. Any elevators configured first will go straight to the top floor and stay there.
Is there something I am not understanding about javascript or the setup?