Is it posible to make logging to the console synchronous? I often run into situations where the code execution is faster than dumping the structures. That resolves in outputting already changed objects.
I sure can walk through the code with debugger, make unit tests etc., it's just often convenient to simply console.log
stuff just to make a general idea of what is going on.
Is it posible to make logging to the console synchronous? I often run into situations where the code execution is faster than dumping the structures. That resolves in outputting already changed objects.
I sure can walk through the code with debugger, make unit tests etc., it's just often convenient to simply console.log
stuff just to make a general idea of what is going on.
3 Answers
Reset to default 11You could create a copy of the object before passing it to console.log
. Look here for a function to create a deep copy of your object.
Edit:
Now implemented in Chrome, see here
I just got caught by this behaviour, spent some hours until I realized the console is borked, not my code. damn.
Until now I only managed to get expected behaviour with:
console.log(JSON.stringify(obj))
nice side effect is, it expands the objects like {0: "a", 3: "b"}
Put a breakpoint(see image below) at console.log statement and use controls to step over to next.