In Safari with no add-ons (and actually most other browsers), console.log
will show the object at the last state of execution, not at the state when conso
I think you're looking for console.dir()
.
console.log()
doesn't do what you want because it prints a reference to the object, and by the time you pop it open, it's changed. console.dir
prints a directory of the properties in the object at the time you call it.
The JSON idea below is a good one; you could even go on to parse the JSON string and get a browsable object like what .dir() would give you:
console.log(JSON.parse(JSON.stringify(obj)));