title: How to check if the input matrix is symmetric?
body: <p>The code below takes in a matrix (<code>MAT</code>) and transposes the matrix, calls it <code>array</code>. The definition of the symmetrical matrix is that it should be a square matrix and the elements in the given matrix compared to the transposed one should be the same.</p>
  <p>The given matrix below and transposed matrix should output <code>false</code> if checked for symmetry.</p>
  <p>I did create an if statement at first to check whether <code>MAT[j][i]</code> and <code>array[j][i]</code> are the same but keep getting the wrong answer. It's not properly checking all the elements together. Could someone help with that?</p>
  <p>Thanks!</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const symmetricMatrix = function (MAT) {
    let array = [];
    for (let i = 0; i &lt; MAT.length; i++) {
      array.push([]);
      for (let j = 0; j &lt; MAT.length; j++) {
        array[i].push(MAT[j][i]);
  
      }
    }
  
    
    return array;
  };
  
  console.log(
    symmetricMatrix(
      (MAT = [
        [1, 3, 1],
        [-1, 1, 4],
        [2, 1, 0],
      ])
    )
  );</code></pre>
  </div>
  </div>
  </p>