I am confused by JS object output.
First one:
var a = {}
console.log(a);
the output for the first one is {}
.
Second one:
var a = {}
console.log(a + '123');
the output for the second one is [object Object]123
Third one:
var a = {
toString: function() {
return 'hello'
}
}
console.log(a + '123');
the output for the third one is hello123
I don't understand why the second one is [object Object]123
while the third one is hello123