JavaScript "Counter" object, what is it?

I accidentally noticed that WebKit and Firefox define a global variable called "Counter" in the window. Any idea what it is?

In Chrome, it looks like that on a watch:

Counter: function Counter() { [native code] } 

Note: this variable is missing in IE (tested with version 10)

+6
source share
2 answers

http://blog.peschla.net/doxygen/v8_chromium_r157275/v8-counters_8h.html

I believe that this means that counters are designed to collect garbage by counting the number of links to any data. Direct or indirect, to help him create a more accurate pointer to call this data or free it from the cache? correct me, if I'm wrong, I'm a newbie .. It was just more fun from Google than to learn.

+2
source

The best I could find related to Rhino: https://developer.mozilla.org/en-US/docs/Rhino/Embedding_tutorial#Counter_example

But in webkit it cannot be installed:

 var c = new Counter(7) TypeError: Illegal constructor var c = Counter(7) TypeError: Illegal constructor 

In Gecko:

 [12:33:24.608] var c = Counter(7) [12:33:24.609] TypeError: Counter is not a function [12:33:29.049] var c = new Counter(7) [12:33:29.051] TypeError: Counter is not a constructor [12:33:31.043] Counter [12:33:31.046] [object Counter] 
+2
source

All Articles