Copy an Object with Object.assign help i'm stuck here

Tell us what’s happening:

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}, { status: action.type})
 return newObject;
      return 
    default:
      return state;
  }
};

const wakeUp = () => {
  return {
    type: 'ONLINE'
  }
};

const store = Redux.createStore(immutableReducer);

Your browser information:

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

Link to the challenge:

It’s close. action.type says “ONLINE”. You want to set the value to “online”.
Normally the action would probably have an status property in this case, setting it to action.status. You could add toLoweCase() for your action.type or hardcode it as “online”.

Also {state} doesn’t need curly bracers.

return Object.assign({}, state, { status : action.type.toLowerCase() });

sorry sir can you exactly write the code what should i have to write//

I added it in the spoiler-tag, click the blurred text to show it.

sir i have written the above blurred code but i didn’t pass

Paste your full code, because I pass using that line.

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
return object.assign( {},state,{status : action.type.toLowerCase()});
return newObject;
return
default:
return state;
}
};

const wakeUp = () => {
return {
type: ‘ONLINE’
}
};

const store = Redux.createStore(immutableReducer);

You have 3 different return statements in the case.
return newObject // newObject doesn’t exist.
return // return what?

Now they won’t really matter because you have a return above them, this one:
return object.assign( {},state,{status : action.type.toLowerCase()});
You have to use capital O in Object.