To Modify an array stored in an object(new)

I have been sitting on this problem for 2 days now and I haven’t been able to come up with an applicable solution to it.

I somehow managed to get this far.

function addFriend(userObj, friend) {
  // Only change code below this line
  // Only change code above this line

console.log(addFriend(user, 'Pete'));

I feel abit lost there and I am trying to figure out how to do it…

The above line is incorrect. There is no user variable. You need to use userObj.

Also, the return statement is incorrect. You need to only return the friends array: return;

1 Like

@piedcipher thank you, thank you so much. I didn’t see it and this solution works. thank you again.

1 Like

Awesome! :tada: I’m glad I could help you :heart: