I just started using the console in Chrome Developer Tools (quite new for Javascript in general). I noticed that when I sequentially write the same variable twice (an object in this case), this log stacks this and places an icon next to it next to it. I click on this thinking that I can see the object twice (since it was updated twice), but nothing happens.
Image for clarification:
As you can see there is a small “2” in the blue circle next to the drop-down list Object. The first magazine would be Object.numat 3, and the second at 4, but all I see is the second.
Object
Object.num
Any answers to the question of how to view both logs would be appreciated.
:.)
log " " , "num" , log.
log
, " ". console.log ( , ).
console.log
, , , Chrome.
function log(obj) { console.groupCollapsed(({}).toString.call(obj).split(' ')[1].split(']')[0]); for (var k in obj) obj.hasOwnProperty(k) && console.log(k + ': ', obj[k]); console.log('__proto__: ', obj.__proto__); console.groupEnd(); }
.
, . , .:)
, . , "num", 4, , , - , . , .
, , , - -
console.log(JSON.parse(JSON.stringify(obj)));
( , .) , JSON.parse JSON .
JSON.parse
debugger; - , JS, script. , .
debugger;
This has happened to me before. The only solution I could find was to output something between the two output calls. For example, if you have this:
console.log(var); ... console.log(var);
do it:
console.log(var); console.log('asdf'); ... console.log(var);
According to the documentation , message stacking can be disabled by enabling timestamps in the general console settings: