Modify an Array Stored in an Object BUG

Modify an Array Stored in an Object BUG
0.0 0


I think this is a bug it won’t let me pass the challenge.

I have double check on my inspect element and it’s showing as 3 arrays successfully.

let user = {
  name: 'Kenneth',
  age: 28,
  data: {
    username: 'kennethCodesAllDay',
    joinDate: 'March 26, 2016',
    organization: 'freeCodeCamp',
    friends: [
    location: {
      city: 'San Francisco',
      state: 'CA',
      country: 'USA'

function addFriend(userObj, friend) {;
	return userObj;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


What do the failing tests say?


there is no error on console

the only one is missing challenge goal was that

addFriend(user, “Pete”) should return [“Sam”, “Kira”, “Tomo”, “Pete”]


You’re returning the entire object. The requirement is to return the friends array. That’s why the test is failing. Your return value isn’t what is expected.


You have to use this :

instead of this :
return userObj;


As it mentionned above , you have returned the entire object .