Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

89
Visualizações
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?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda