📜  在 javascript 代码示例中添加两个矩阵

📅  最后修改于: 2022-03-11 15:03:39.298000             🧑  作者: Mango

代码示例1
//Declare and initialize 2 two-dimensional arrays a and b.
//Calculate the number of rows and columns present in the array a (as dimensions of both the arrays are same) and store it in variables rows and cols respectively.
//Declare another array sum with the similar dimensions.
//Loop through the arrays a and b, add the corresponding elements
//e.g 
matrix a11 = [1 0 1
              5 4 6]
matrix b11 = [ 2 2 2
              2 3 1]
a11 + b11 = var sum11;
//Display the elements of array sum.
print (sum11);