Try to work with Javascript's arrays, it's a nightmare.
Fun fact:
let list = new Array(5);
list.forEach(() => { console.log("foo"); })
Will display nothing, if you want to properly initialize an array with a defined length, you have to do: let list = Array.apply(null, Array(5)).map(function () {})
I make web games in Typescript, and I get all sorts of problems like this everytime I have to work with 2D arrays, problems that I don't get when I do games in C# with Unity. Unity's modified Javascript actually implements better arrays and recommends not using Javascript's native arrays: http://docs.unity3d.com/ScriptReference/Array.html