Remove Object from Array

After assigning objects to variables, remove one from an array based on the variable name.

JavaScript

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'
}

//Above you're given an empty array with four objects. Fill the devMountainEmployees array with those four objects. After that console.log the length of the Array and make sure that it's equal to 4.

//your code here
devMountainEmployees.push(tyler, cahlan, ryan, colt);


console.log(devMountainEmployees.length);
alert(devMountainEmployees.length);
alert(JSON.stringify(devMountainEmployees));

//Now let's say Cahlan has a mental breakdown and has to take a leave of absense to 'find himself'. Loop through your devMountainEmployees until you find cahlan, then remove him from the array.

//your code here
/* for (var i = 0; i < devMountainEmployees.length; i++) {
    if (devMountainEmployees[i] === cahlan) {
        devMountainEmployees.splice(i, 1);
    }
} */


//Now console.log your final array and make sure that it's correct.
console.log(devMountainEmployees);