Copy an Object with Object.assign looks like it should pass

Copy an Object with Object.assign looks like it should pass


Tell us what’s happening:
My console.log is giving me the correct answer from what I understand but it still won’t pass this test “should update the property status in state to online and should NOT mutate state.” Can anyone see why? Thank you.

Your code so far

const defaultState = {
  user: 'CamperBot',
  status: 'offline',
  friends: '732,982',
  community: 'freeCodeCamp'

const immutableReducer = (state = defaultState, action) => {
  switch(action.type) {
    case 'ONLINE':
      // don't mutate state here or the tests will fail
    const newObject = Object.assign({}, state, action);
    newObject.status = action.type.toLowerCase();
    return newObject;
      return state;

const wakeUp = () => {
  return {
    type: 'ONLINE'
const store = Redux.createStore(immutableReducer);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36.

Link to the challenge:


Why are you passing action as a source object?


Good question. Let me take a look. By the way are you an author?


That did it for me. Thanks Randell.


Am I an author of what?


In the realm of coding. Just curious.


Not unless you count the thousands of responses I have given on the forum.


I see you put your knowledge to work with your company. Thats cool.