Multiply 2 matrices in Javascript
I'm doing a function that multiplies 2 matrices. The matrices will always have the same number of rows and columns. (2x2, 5x5, 23x23, ...) When I print it, it doesn't work. Why? For example, if I create two 2x2 matrices: matrixA: [1][2] [3][4] matrixB: [5][6] [7][8] The result should be: [19][22] [43][50] ( http://ncalculators.com/matrix/2x2-matrix-multiplication-calculator.htm ) But, I get: [19][undefined] [22][indefined] function multiplyMatrix(matrixA, matrixB) { var result = new Array();//declare an array //var numColsRows=$("#matrixRC").val(); numColsRows=2; //iterating through first