This is my first time asking a question so go easy on me. I am currently in class learning JavaScript and am loving it so far. I am having issues with one of our assignments however.
I have an array with 4 objects inside of it. My current goal is to remove a specific object from the array. It's not on the end so I would assume I need to use a for loop to do so, but am having trouble with the syntax. My current code is as follows:
var devMountainEmployees = [];
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'
}
devMountainEmployees.push(tyler, cahlan, ryan, colt);
console.log(devMountainEmployees.length);
The one I want to remove is cahlan and I need to use a loop.
Thanks for your help guys.