title: How to find Symmetric and reflexive using javascript
body: <p>For my assignment, I have to find whether the set of relation (that I take from 2-D array) are symmetric or/and transitive.Below is 2-D array for relation, R={(1,3),(2,2),(2,3),(3,2),(3,1)} //This relation may be change as I take value from input by user.</p>
  
  <pre><code>var r = new Array(5);
  r[0] = [1,3];
  r[1] = [2,2];
  r[2] = [2,3];
  r[3] = [3,2];
  r[4] = [3,1];
  </code></pre>
  
  <p>So what i want to know is how to identified base on this array. I have done for symmetric but it still did not show a correct result. Based on the array it should get output "IT IS SYMMETRIC". I still cannot find symmetric so i cannot proceed on finding whether it is transitive or not.</p>
  
  <pre><code>for(var i = 0; i &lt; 5; i++){ //row
      for(var j = 1; j &lt; 5; j++){ 
          if(r[i][1] == r[j][0])  
          {
              if(r[i][0] == r[j][1])
              {
                  symmetric = symmetric + 1;
              }
          }
          else if (r[i][0] == r[i][1])
              {
                  symmetric = symmetric + 1;
              }
          else 
          {
              symmetric = -1;
          }
      }
      //j= j + 1;
  }
  if(symmetric &gt; 0)
  {
      alert("IT IS SYMMETRIC");
  }
  else
      alert("IT IS NOT SYMMETRIC");
  </code></pre>