ecmascript-3

Using htmlfile COM object to access the .getOwnPropertyDescriptor() method of an object in WSH JScript

佐手、 提交于 2020-12-15 05:31:23
问题 In the comments of this question, I was told that the .getOwnPropertyDescriptor() method isn't supported in ES3 ..., so it probably isn't supported in JScript [either] and that is indeed what I see when trying to invoke that method in cscript.exe / wscript.exe : Object doesn't support this property or method However, the latest JScript version I'm using is 5.812 and according to this document, the method should be available in 5.8* JScript. The discrepancy has also been noted in this post,

How to get all Unicode characters from specific categories?

大兔子大兔子 提交于 2019-12-24 07:58:17
问题 How to get, for example..., a code point pattern like x-y\uxxxx\Uxxxxxxxxx from the Connector Punctuation ( Pc ) category, for scanning ECMAScript 3/JavaScript identifiers? Original question I need help for verifying a valid character (code point) of a ECMA-262 (3º edition, 7.6) identifier for a lexical scanner. Syntax quote Identifier :: IdentifierName but not ReservedWord IdentifierName :: IdentifierStart IdentifierName IdentifierPart IdentifierStart :: UnicodeLetter $ _ \

Was there a way to create an object without a prototype prior to ES5?

懵懂的女人 提交于 2019-12-23 02:41:27
问题 Was there a way to create an object without a prototype prior to ES5? i.e. something like Object.create(null) (ES5) I thought something like this might work, but the final statement unexpectedly returns true : function withPrototype(p) { function temp(){} temp.prototype = p; return new temp(); } Object.getPrototypeOf(withPrototype(null)) === Object.prototype; // true Object.getPrototypeOf is ES5. I use it here for exposition. 回答1: As @Oriol has shown, there was no "official" (spec-compliant)

Was there a way to create an object without a prototype prior to ES5?

孤街醉人 提交于 2019-12-06 15:47:39
Was there a way to create an object without a prototype prior to ES5? i.e. something like Object.create(null) (ES5) I thought something like this might work, but the final statement unexpectedly returns true : function withPrototype(p) { function temp(){} temp.prototype = p; return new temp(); } Object.getPrototypeOf(withPrototype(null)) === Object.prototype; // true Object.getPrototypeOf is ES5. I use it here for exposition. Bergi As @Oriol has shown, there was no "official" (spec-compliant) way to do this. However, there was indeed an object that had no prototype - Object.prototype itself.

Why variable object was changed to lexical environment in ES5?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 03:33:24
问题 ES5 changed variable object(VO) to lexical environment. What's the motivation of such change since VO is already very obvious as perception? 回答1: I think variable objects are more analogous to environment records. An Environment Record records the identifier bindings that are created within the scope of its associated Lexical Environment. In ES5 there are two different kinds of environment records: Declarative environment records are used to define the effect of ECMAScript language syntactic

Do RegExps made by expression literals share a single instance?

拜拜、爱过 提交于 2019-11-28 11:01:14
问题 The following snippet of code (from Crockford's Javascript: The Good Parts ) demonstrates that RegExp objects made by regular expression literals share a single instance: function make_a_matcher( ) { return /a/gi; } var x = make_a_matcher( ); var y = make_a_matcher( ); // Beware: x and y are the same object! x.lastIndex = 10; document.writeln(y.lastIndex); // 10 Question : Is this the same with any other literals? I tried modifying the code above to work with the string "string" , but got a