When I log something like console.log('' + {}); the console would print [Object object] in Chrome, but something different ({}) in node. At this point I would have thought that the console output depends on the execution environment.
However, recently I discovered that, given some not-null object foo, I somehow had Chrome print null instead of the expected output above. So using console.log('' + foo); resulted in null in the console. How is that possible? My first guess was that I must have overridden something important accidentally, like some toString() method. Otherwise I could not explain why Chrome would interpret some not-null object as null when it is added to a string.
Does anyone know how that implicit object-to-string conversion actually works? It is not that this is a show-stopper, but it really makes me wonder.
Edit: I did not include a JSFiddle because this occurs in some quite dependency-heavy class, so there is no proper minimal working example I could offer you. The question does not refer to my code anyway, it is rather basic and technical.
Another edit: For the sake of completeness, I am adding the screenshot I posted in the comments.