matrixDot = (mat1, mat2) => {
  console.assert(mat1.length === mat2.length, 'Dimension not matching');
  console.assert(mat1[0].length === mat2[0].length, 'Dimension not matching');

  let result = 0;
  for (let i = 0; i < mat1.length; i++){
    for (let j = 0; j < mat1[0].length; j++){
      result += mat1[i][j] * mat2[i][j];
    }
  }
  
  return result;
}
Dot product of two matrices.
@param {[[number]]} mat1 Matrix 1
@param {[[number]]} mat2 Matrix 2