I'm trying in Firebug a code decripted in theJavascript definitive guide
But when i execute it, firebug throws me reference error at uniqueInteger.counter = 0;PHP Code:// Initialize the counter property of the function object.
// Function declarations are hoisted so we really can
// do this assignment before the function declaration.
uniqueInteger.counter = 0;
// This function returns a different integer each time it is called.
// It uses a property of itself to remember the next value to be returned.
function uniqueInteger() {
return uniqueInteger.counter++; // Increment and return counter property
}
Why? It's a syntax allowed in some browser and not in other?


Reply With Quote
Bookmarks