Here is a basic Node.js program to perform matrix multiplication.
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
To know more about Node.js, click here!
Source Code:
let r = 2;
let c = 2;
const mA = [[1, 2], [3, 4]];
const mB = [[1,-1], [2,-2]];
const mC = [[],[]];
for(let i=0;i<r;i++)
{
for(let j=0;j<c;j++)
{
mC[i][j]=0;
for(let k=0;k<c;k++)
{
mC[i][j]= mC[i][j] + mA[i][k]*mB[k][j];
}
}
}
console.log(mC);
Output:
[ [ 5, -5 ], [ 11, -11 ] ]