JSFiddle - React, Tailwind, and code Playground

by Varun Nath

JavaScript

var selection =[{checkinId:1,dealId:2},{checkinId:10,dealId:5}];
var checkins = [{id:1},{id:10}];

console.log(selection);
var selectionIds = [];

function displayVerified(selection){
   
    for(i=0;i<selection.length;i++)
    {
        selectionIds.push(selection[i].checkinId);
    }

    angular.forEach(checkins,function(value,key){
       
      var id = selectionIds.indexOf(value.id);

        if(id>-1)
        {//update verified to 1 - this will update dom using ng-show="user.verified"
            value.verified=1;
            alert('verified');
        }

        selection={};
    });
}

displayVerified(selection);
console.log(selectionIds);
console.log(selection);
console.log(checkins);