Object Logs final key to console without using console.log


When I create an object and run it it ends up outputting the final key in the object without me trying to make it do that.
Is this normal?
I can’t seem to find something wrong or missing.

when I enter this

var myObject = {};
myObject.key1 = "This doesn't log",
myObject.key2 = "But this does";

It prints out this

"But this does" 


console behaviour, the last value is echoed.

But that was the old learning environment, i thought it didn’t occur on the new one, can you share the exercise url?


So just fiddling around I tried using literal notation and for some reason it stopped doing it.
There must be something I’m missing in the original sample.

Doing it like this

var myObject = {
key1:"This doesn't log",
key2:"But this does"

Doesn’t print anything.




thanks for the prompt reply


its console behaviour, i wouldn’t worry about it just yet

i would highly recommend upgrading the a supported course:


or if you prefer es6:


the course you are currently taking is no longer supported


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.