0

For some reason, every time my code comes to this line of code,

shuttle.seats[passenger]=null;

it executed that line, but does not continue on. This is the line of code in context:

for (passenger in shuttle.seats) {
        if (shuttle.seats[passenger]!=null) {
            for (house in HOUSES) {
                if (house==shuttle.seats[passenger].house && shuttle.distance(HOUSES[house].lat,HOUSES[house].lng)<30) {
                    points++;
                    alert("Dropped off "+shuttle.seats[passenger].name+"\nyou currently have "+points+" points! Congrats");
                    shuttle.seats[passenger]=null;
                    chart();
                }
            }
        }
    }
2
  • What do you mean, does not continue on? Are you sure that chart() is not being called? Do you see any sort of error? What's happening?
    – Air
    Jul 8 '14 at 20:11
  • That's the odd thing. chart() is being called, but the loop stops, so only one person is let off at a time. I do not get any errors
    – coenvalk
    Jul 10 '14 at 1:14
0
  1. You may use your console to trace each step of your program, and see what goes wrong.
  2. You can swap the instructions alert and shuttle.seats[passenger]=null; and see if the alert is called: if the alert is not called, the issue is the line you posted, else the problem is in the alert line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .