Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!