'Javascript function seems to prevent page from loading

So I have the following javascript that, as an exercise is supposed to multiply 2 object as matrices. The Mat4 object stores a 4 * 4 matrix as a 1 * 16 array.

function mul(a,b)
{
  if(a.width != b.height)
  {
    console.error("Invalid multiplication");
    return;
  }
  var v = [];
  var p = 0;
  for(let ar = 0; ar < a.height; ar ++)
  {
    for(let bc = 0; bc < b.width; bc ++)
    {
      for(let acbr = 0; acbr < a.width; bc ++)
      {
        p += a.value[ar * a.width + acbr] * b.value[acbr * b.width + bc];
      }
      v[ar * b.width + bc] = p;
      p = 0;
    }
  }
  return v;
}
let foo = new mat4([1]);
console.log(foo.value);
let bar = new mat4([1]);
console.log(bar.value);
let bee = mul(foo,bar);
console.log(bee);

The web page won't load, but when I comment

¨let bee = mul(foo,bar);¨

It loads just fine. I can't find any problem in function mul So I think there's something i'm missing. How can I make the mul function work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source