title: JSON Array element comparion with Java Script Array in Angular 2
body: <p>I am working on Angular 2 with type script and came up with a very peculiar problem.
  I have a number array named empIds as</p>
  
  <pre><code>empIds = {1,5,6,9,2}
  </code></pre>
  
  <p>I have (a JSON Array) named empDetails (please note employeeId is string here)as </p>
  
  <pre><code>empDetails [{"employeeId":"1","employeeName":"Jhon"},
              {"employeeId":"2","employeeName":"Ron"},
              {"employeeId":"3","employeeName":"Van"}]
  </code></pre>
  
  <p>Now i have to find out the only JSON objects who's id match in number array.
  Here is what i wrote</p>
  
  <pre><code>for(let i=0;i&lt;empDetails.length;i++){
  if(empIds.indexOf(empDetails[i].employeeId)==0 ){
  //Employee ID is present save that JSON object to some other JSON Array
  i should get details for matched id (1 and 2)
  }else{
  //Did not match
  do nothing
  }
  }
  </code></pre>
  
  <p>i did put console.log for both if and else. My loop never matches it always goes to else condition?
  Is there any possible solution?</p>