title: JavaScript minus calculation between two variables
body: <p>Basically I am trying to compare if the coordinates passing in match the items in an array list. So I have an array called busList with array item in this format:</p>
  
  <pre><code>27794.27939,43930.90485
  </code></pre>
  
  <p>And then I am trying to loop thru the array to compare the coordinates that I passed in. The coordinates that I passed in are two variables: coordx and coordy. </p>
  
  <pre><code>for(var i = 0; i &lt; busList.length; i++){
      var parts = busList[i].split(",");
      buslocX = parts[0];
      buslocY = parts[1];
  
      if((coordx - buslocX &lt; 0.0050) &amp;&amp; (coordy - buslocY &lt; 0.0050)){
          console.log(coordx - buslocX);
      }
  }
  </code></pre>
  
  <p>If the coordx - the x coordinates in the array is less than 0.0050 and as well as the y, then I will perform something else. With these codes, I am trying to print the result of the minus, but I did not get anything in the console.</p>
  
  <p>Any ideas? Thanks in advance.</p>
  
  <p>In a short word, I am trying to check if coordx,coordy matches any items inside the array. But there will be slight difference like 0.0050 for the coordx,coordy with the array items. For example, I got a list of coordinates for array:</p>
  
  <pre><code>27794.27939,43930.90485
  27539.43390,43422.26042
  </code></pre>
  
  <p>And the coordx I passed in is 27794.27920 and coordy is 43930.90480. Because both of the coordx and coordy is less than 0.0050 than first item in array, then I will perform something else.</p>