console.count([obj]) places a counter on the object's value provided as argument. Each time this method is invoked, the counter is increased.
Note:-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 dizsweb_1 = 1, dizsweb_2 = '2', dizsweb_3 = "";
console.count(dizsweb_1 );
console.count(dizsweb_2 );
console.count(dizsweb_3 );
console.count(1);
console.count('2');
console.count('');
Displays:
1: 1 2: 1 : 1 1: 2 2: 2 : 1
Strings with numbers are converted to Number objects let see:
console.count(42.3);
console.count(Number('42.3')); console.count('42.3');
Displays:
42.3: 1 42.3: 2 42.3: 3
Functions point always to be the global Function object:
console.count(console.constructor);
console.count(function(){});
console.count(Object);
var function_1 = function myfn(){};
console.count(function_1);
console.count(Number);
Displays:
[object Function]: 1
[object Function]: 2
[object Function]: 3
[object Function]: 4
[object Function]: 5
Certain objects get speciļ¬c counters associated to the type of object they refer to:
console.count(undefined);
console.count(document.Batman);
var obj; console.count(obj);
console.count(Number(undefined));
console.count(NaN);
console.count(NaN+3);
console.count(1/0);
console.count(String(1/0));
console.count(window);
console.count(document);
console.count(console);
console.count(console.__proto__);
console.count(console.constructor.prototype); console.count(console.__proto__.constructor.prototype); console.count(Object.getPrototypeOf(console));
console.count(null);
Displays:
undefined: 1
undefined: 2
undefined: 3
NaN: 1
NaN: 2
NaN: 3
Infinity: 1
Infinity: 2
[object Window]: 1
[object HTMLDocument]: 1
[object Object]: 1
[object Object]: 2
[object Object]: 3
[object Object]: 4
[object Object]: 5
null: 1
Empty string or absence of argument
If no argument is provided while sequentially inputting the count method in the debugging console, an empty string is assumed as parameter, i.e.:
> console.count();
: 1
> console.count('');
: 2
> console.count("");
: 3
See also Following links-
JavaScript- Measuring console Time()
Javascript Console opening in different browser
Note:-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 dizsweb_1 = 1, dizsweb_2 = '2', dizsweb_3 = "";
console.count(dizsweb_1 );
console.count(dizsweb_2 );
console.count(dizsweb_3 );
console.count(1);
console.count('2');
console.count('');
Displays:
1: 1 2: 1 : 1 1: 2 2: 2 : 1
Strings with numbers are converted to Number objects let see:
console.count(42.3);
console.count(Number('42.3')); console.count('42.3');
Displays:
42.3: 1 42.3: 2 42.3: 3
Functions point always to be the global Function object:
console.count(console.constructor);
console.count(function(){});
console.count(Object);
var function_1 = function myfn(){};
console.count(function_1);
console.count(Number);
Displays:
[object Function]: 1
[object Function]: 2
[object Function]: 3
[object Function]: 4
[object Function]: 5
Certain objects get speciļ¬c counters associated to the type of object they refer to:
console.count(undefined);
console.count(document.Batman);
var obj; console.count(obj);
console.count(Number(undefined));
console.count(NaN);
console.count(NaN+3);
console.count(1/0);
console.count(String(1/0));
console.count(window);
console.count(document);
console.count(console);
console.count(console.__proto__);
console.count(console.constructor.prototype); console.count(console.__proto__.constructor.prototype); console.count(Object.getPrototypeOf(console));
console.count(null);
Displays:
undefined: 1
undefined: 2
undefined: 3
NaN: 1
NaN: 2
NaN: 3
Infinity: 1
Infinity: 2
[object Window]: 1
[object HTMLDocument]: 1
[object Object]: 1
[object Object]: 2
[object Object]: 3
[object Object]: 4
[object Object]: 5
null: 1
Empty string or absence of argument
If no argument is provided while sequentially inputting the count method in the debugging console, an empty string is assumed as parameter, i.e.:
> console.count();
: 1
> console.count('');
: 2
> console.count("");
: 3
See also Following links-
JavaScript- Measuring console Time()
Javascript Console opening in different browser