> My problem is MoveRight() won't run unless MoveLeft() is called first. This
> doesn't make sense - both functions are identical except for increments
> instead of decrements. I  get cell[PosX +1] is not defined (why not
> cell[PosX + 1][PosY]??) if I call MoveRight() first, but if I call
> MoveLeft() then MoveRight() everything gets defined. I've been stuck on
> this for days now.

Your  Fiddle  isn't exactly functional, so I don't know what your real
site  is  returning,  but  it  seems  likely  that  you've been overly
optimistic  about  type juggling from undefined -> (int)0, but what is
actually  happening  is  you  have right1 = (int)NaN (number type, but
not-a-number  value).  Then you try to find the index cell[NaN], which
barfs.

-- S.

Reply via email to