JSFiddle - React, Tailwind, and code Playground

by kyllle

JavaScript

console.clear();

var exclude = [
        {
            id: 1,
            name: 'John'
        }
 ];


var peopleArr = [
        {
            id: 1,
            name: 'John'
        },
        {
            id: 2,
            name: 'James'
        },
        {
            id: 3,
            name: 'Simon'
        }
    ];

var myObj = [];
for(key in peopleArr) {
    for(k in exclude) {
                
        if(JSON.stringify(peopleArr[key]) != JSON.stringify(exclude[k])) {
            
            console.log(peopleArr[key]);
            myObj.push(peopleArr[key]);
            
        }
    }
}

console.log(myObj);