Because defaultState is {login: false}.
When you use Object.assign you’re setting up a variable ‘login’ set to true, then you overwrite that variable with the value false ( Object assign overwrite the properties with the same value);
Just do it once ( set login to true) and will be fine, there will be no need of the variable declaration since you can return directly the object with the correct value^^
you’ll notice that the output is correct ({login:true}) but something in the code confuse the test check.
Object assign ( reference: MDN - Objet.assign() ) is used to have at least two arguments, a source and a target ( it assign the property of the source(s) to the target. I’ve never seen it used with just one argument so I can’t say what’s wrong ( apparently nothing ) but if you use that method appropriately ( Object.assign( {}, defaultState) the test will pass
That said, I was suggesting you to return just the action: if you want you can check the code here ( yours is fine but I think this could make more clear what return action means):
Usually ctrl + shift + I will open the console (the browser one).
I found out that if you use that combination while focus is into the challenge window ( where you type the code ) it doesn’t work for me: I have to take out the focus ( just click in another part of the screen ): anyway this happen to me, I didn’t tested for other browser / system so if the same problem will occur to you just try that ^^
Oh, i think there was a misunderstanding ^^
You should keep writing your code in the challenge editor, it’s only the result of ( console.log(‘stuff’) ) that appear into the browser console ^^
Here is a screenshot:
Oh, I never know that, you are so clever!
Thanks!
I think I just have a hard time in something, but your message at this moment comforting me a lot!
And it’s funny, I never thought when I run code in freecodecamp and open the console to see the result.