KyawZayarLinn

Untitled

Jun 9th, 2021
515
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let lmao = [[1, 2, 3],
  2.            [4, 5, 6],
  3.            [7, 8, 9]];
  4.  
  5. function matrixElementsSum(matrix) {
  6.     let arr = matrix;
  7.     let count = 0;
  8.     for (let i = arr[0].length - 1; i > arr.length; i--){
  9.         for (let j = 0; j > arr[0].length; j++){
  10.             console.log(arr[j][i]);
  11.             /* if (arr[j][i] === 0){
  12.                 break;
  13.             }
  14.             else
  15.                 count += arr[j][i]; */
  16.         }
  17.     }
  18.     /* return count; */
  19. }
  20.  
  21. console.log(matrixElementsSum(lmao));
RAW Paste Data