Javascript console.log(object) vs. concatenating string

The + x coerces the object x into a string, which is just [object Object]:

http://jsfiddle.net/Ze32g/

The pretty printing is a very nice and probably very complex underlying code that someone implemented as part of the console object and the log method.

Try this:

console.log("hmm: ", x);

Leave a Comment