let filteredDatatableData = this.datatableDataToFilter.filter(function(item) { const arrSome = lstCustomerResponseTO.some(v => v.person_id === item.personId); return arrSome ? true : false; }); ---------------------------------------------------------------------------------------- var datatableData = [{"name":"Teste1","personId":"01"},{"name":"Teste1","personId":"02"},{"name":"Teste1","personId":"03"}]; var lstCustomerResponseTO = [{"name":"Teste1","personId":"01"},{"name":"Teste1","personId":"03"}]; let filteredDatatableData = datatableData.filter(function(item) { const arrSome = lstCustomerResponseTO.some(v => v.personId === item.personId); return arrSome; }); console.log(filteredDatatableData)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter