From 252c7f8bac53c5dbb36843376be2113cc4562883 Mon Sep 17 00:00:00 2001 From: idanT Date: Fri, 2 Feb 2018 20:21:23 +0200 Subject: [PATCH] Update matrix.js --- matrix.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix.js b/matrix.js index 8ccd4c9..9d54d25 100644 --- a/matrix.js +++ b/matrix.js @@ -54,9 +54,9 @@ class Matrix { add(n) { if (n instanceof Matrix) { - for (let i = 0; i < this.rows; i++) { - for (let j = 0; j < this.cols; j++) { - this.data[i][j] += n.data[i][j]; + for (let j = 0; j < this.rows; j++) { + for (let i = 0; i < this.cols; i++) { + this.data[j][i] += n.data[j][i]; } } } else {