console.count('label'); console.count('label'); console.count('other'); console.count('label');
The console.count method prints the label followed by the number of times it has been called with that label. Each call increments the count for that label.
console.assert(false, 'Assertion failed!'); console.assert(true, 'This will not show');
console.assert prints the message only if the condition is false. It does not throw an error, just logs the message.
console.log('Start'); console.group('Group 1'); console.log('Inside group'); console.groupEnd('Group 1'); console.log('End');
console.group indents the output of subsequent logs until console.groupEnd is called. The group label itself is printed without indentation.
console.time('timer'); setTimeout(() => { console.timeEnd('timer'); }, 100);
console.time starts a timer with a label. console.timeEnd stops the timer and prints the elapsed time. The time will be close to the delay in setTimeout.
function a() {
b();
}
function b() {
c();
}
function c() {
console.trace('Trace here');
}
a();console.trace prints the message and the full call stack showing the order of function calls leading to it, starting from the current function back to the entry point.
