JavaScript Pitfalls
We will see some other quirks and pitfalls here [object Object] We can get the [object Object] if we try to console log a object while trying to concat a string with it. const obj = { val: 32 }; console.log(obj); //prints { val: 32 } console.log(obj + 'A'); //prints [object Object]A Internally JS tries to convert obj into a string by doing obj.toString() resulting in [object Object] ! Now what exactly does it mean ? The first is object (with a small o), this shows the type tag. JavaScript by default tags every datatype as objectif its not a primitive type like number or string. ...