Below, you can see the output from these two logs. The first clearly shows the full object with the property I\'m trying to access, but on the very next line of code, I can\
The output of console.log(anObject)
is misleading; the state of the object displayed is only resolved when you expand the Object tree displayed in the console, by clicking on >
. It is not the state of the object when you console.log
'd the object.
Instead, try console.log(Object.keys(config))
, or even console.log(JSON.stringify(config))
and you will see the keys, or the state of the object at the time you called console.log
.
You will (usually) find the keys are being added after your console.log
call.