addition of two matrix in javascript

Solutions on MaxInterview for addition of two matrix in javascript by the best coders in the world

showing results for - "addition of two matrix in javascript"
Carrie
14 Mar 2020
1//Declare and initialize 2 two-dimensional arrays a and b.
2//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.
3//Declare another array sum with the similar dimensions.
4//Loop through the arrays a and b, add the corresponding elements
5//e.g 
6matrix a11 = [1 0 1
7              5 4 6]
8matrix b11 = [ 2 2 2
9              2 3 1]
10a11 + b11 = var sum11;
11//Display the elements of array sum.
12print (sum11);