Javascript console.count()
console.count([obj]) places a counter on the object's value provided as argument. Each time this method is
invoked, the counter is increased (with the exception of the empty string ''). A label together with a number is displayed in the debugging console according to the following format:
[label]: X
label represents the value of the object passed as argument and X represents the counter's value.
An object's value is always considered, even if variables are provided as arguments:
var o1 = 1, o2 = '2', o3 = "";
console.count(o1);
console.count(o2);
console.count(o3);
console.count(1);
console.count('2');
console.count('');
Output
2: 1
: 1
1: 2
2: 2
: 1
Strings with numbers are converted to Number objects:
console.count(42.3);
console.count(Number('42.3'));
console.count('42.3');
Output
42.3: 2
42.3: 3
Functions point always to the global Function object:
console.count(console.constructor);
console.count(function(){});
console.count(Object);
var fn1 = function myfn(){};
console.count(fn1);
console.count(Number);
Output
[object Function]: 2
[object Function]: 3
[object Function]: 4
[object Function]: 5