2d vectors in Javascript