I have array of objects, I am trying to loop through that array and if I find found a match, I wanna slice that object..
var object = [
{
"Name": 'Kshitij',
"LastName": 'Rangari',
"CountryBorn": 'India',
"CountryStay": 'USA'
},
{
"Name": 'Pratik',
"LastName": 'Rangari',
"CountryBorn": 'India',
"CountryStay": 'Canada'
},
{
"Name": 'Pratibha',
"LastName": 'Rangari',
"CountryBorn": 'India',
"CountryStay": 'India'
},
{
"Name": 'Ankita',
"LastName": 'Raut',
"CountryBorn": 'India',
"CountryStay": 'Australia'
},
{
"Name": 'Wayne',
"LastName": 'Rooney',
"CountryBorn": 'UK',
"CountryStay": 'UK'
}
]
console.log(object);
object.forEach(function(x){
if (x.Name==='Kshitij'){
}
})
object.map (obj =>{
obj.AllFirstName = obj['Name'];
console.log(obj['AllFirstName']);
})
console.log('------------------------------')
console.log(object);
I wanna loop through Object and want to find if Name === 'Kshitij'
and Name ==='Pratik'
, I want to remove those objects from the array.
How would I do this ?