JSFiddle - React, Tailwind, and code Playground

by vasi_32

JavaScript

var arr = [20122, 20133, 20144, 20155, 20177];
var jsonObj=[{"ext":"20177","name":"SIP\/20177-000001e8","state":"Ringing"},{"ext":"20122","name":"SIP\/20122-000001e7","state":"Ringing"}]

arr.forEach(function(item){
 var _getValue ="";  
     var _isPresent=jsonObj.find(function(item2){
      if(item == +item2.ext){
        return item2;
       }
        else{
         return false;
        }
})
if(_isPresent !== undefined){
   _getValue =_isPresent.ext;
}
else{
  _getValue="Not matched";
}
document.write('<pre>'+_getValue+'</pre>')
})