I have this array which I've had to push the objects into the array. But now I am trying to get rid of the whole object for 'cahlan'. The for loop at the bottom is what I've tried but it doesn't seem to work.
var employees = [];
var tyler = {
name: 'Tyler',
position: 'Lead Instructor/Engineer',
spiritAnimal: 'Honey Badger'
};
var cahlan = {
name: 'Cahlan',
position: 'CEO',
spiritAnimal: 'butterfly'
};
var ryan = {
name: 'Ryan',
position: 'Marketing',
spiritAnimal: 'fox'
};
var colt = {
name: 'Colt',
position: 'Everything really',
spiritAnimal: 'Young Male Horse'
};
employees.push("tyler", "cahlan", "ryan", "colt");
for (var i = 0; i < employees.length; i++) {
if (employees[i].name === "Cahlan") {
employees.splice(i);
}
}