[Newbie] Javascript objects not created correctly


Sorry for a naive question. I am a newbie to freecodecamp and I was trying to solve the algorithm problems. I created an object as:

var hashMap = new Map();
hashMap.set(1, 'hello');

I expect an element in my hashmap object. However, when I check it using:


The output is:

Can anyone please point out what I am doing wrong?

It is just a bug in the FCC console (which is not the same as your browser’s console). Run the Tests and you will see what console.log actually displays using your code.

Thanks! It is also worth mentioning that console.log() does not print the string representation of complex javascript objects like hashmap, set etc.

you can use JSON.strigify() for those