In Safari without any add-ons (and indeed in most other browsers), console.log
will show the final state of the object during execution, not ;console.log
The status when called.
I have to clone the object in order to output it via console.log
to get the status of the object at that line of code.
Example:
var test = {a: true} console.log(test); // {a: false} test.a = false; console.log(test); // {a: false}
If I want to see its status at the time of recording, I usually convert it to a JSON string.
I think you are looking for
console.dir()
.console.log()
cannot achieve the function you want, because it prints a reference to the object, and it has changed when you open it.console.dir
The attribute directory of the object will be printed when called.The JSON idea below is a good one; you could even go ahead and parse the JSON string and get a browsable object, like .dir() would give you:
console.log(JSON.parse(JSON.stringify(obj)));