Subj : Re: Array and [ ] To : Igor Bukanov From : Brendan Eich Date : Sat Jan 22 2005 04:29 pm Igor Bukanov wrote: > Hi! > > Consider the following JS: > > function Array() > { > if (typeof alert == "function") > alert("Intercepted"); > else > print("Intercepted"); > } > > var x = []; > > > In SpiderMonkey and Rhino it prints "Intercepted", while in MS JScript > it prints nothing, that is AFAICS in MS JScript [] always uses original > Array constructor while SM and Rhino literally follows 11.1.4 in > ECMAScript standard which states: > > The production ArrayLiteral : [ Elision opt ] is evaluated as follows: > 1. Create a new array as if by the expression "new Array()" The spec is unambiguous here. Elsewhere, it talks about "the original value of the Object.prototype property", or similar such words. This should be fixedd at some point, but I haven't managed to get the ECMA TG1 group as a whole to go through the http://www.mozilla.org/js/language/E262-3-errata.html yet, let alone consider this question. Another way to fix things is to make Array readonly and permanent in the global object (likewise all standard class constructors and other predefined global properties). /be .