Ok, I’m not using Object.keys().
But the function returns the array with the four names.
Nevertheless, it doesn’t pass .
let user = {
name: 'Kenneth',
age: 28,
data: {
username: 'kennethCodesAllDay',
joinDate: 'March 26, 2016',
organization: 'freeCodeCamp',
friends: [
'Sam',
'Kira',
'Tomo'
],
location: {
city: 'San Francisco',
state: 'CA',
country: 'USA'
}
}
};
function addFriend(userObj, friend) {
// change code below this line
// console.log(userObj.data.friends[3]);
userObj.data.friends[3] = friend;
//console.log(userObj.data.friends);
return userObj.data.friends
// change code above this line
}
console.log(addFriend(user, 'Pete'));
Your browser information:
User Agent is: Chrome/69.0.3497.100 .
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object