kyler decides to delete his account. Loop through your array of objects until you find kyler's account - use kyler@test.com to find him in the array. Once you find the particular index he's located in, delete him from the array.
var users = [{
name: 'talon',
email: 'talon@test.com',
password: 'test1234',
username: 'tdog',
},{
name: 'lauren',
email: 'lauren@test.com',
password: 'admin1234',
username: 'ldogg',
},{
name: 'cohen',
email: 'cohen@test.com',
password: 'baby1234',
username: 'cdoggy',
},{
name: 'kyler',
email: 'kyler@test.com',
password: 'delete1234',
username: 'kdawg'
}];
This is what I have so far, but I am spinning my wheels:
function deleteUser(arr)
for (var i = 0; i < users.length; i++) {
if (arr.indexOf([i]) === 'kyler@test.com') {
users.slice(arr[i]);
}
}
I am not sure if each of my users needs a variable assigned in the array or if it is my slice. Any guidance would be awesome. Thanks