ecma262

Does a function expression have its own scope/lexical environment

痴心易碎 提交于 2020-01-13 10:25:09
问题 I'm reading the Execution Context / Lexical Environment section of the ECMA 262 5 specification. It states the following: (emphasis added) A Lexical Environment is a specification type used to define the association of Identifiers to specific variables and functions based upon the lexical nesting structure of ECMAScript code. A Lexical Environment consists of an Environment Record and a possibly null reference to an outer Lexical Environment. Usually a Lexical Environment is associated with

ANTLR parser hanging at proxy.handshake call

元气小坏坏 提交于 2020-01-02 05:14:18
问题 I am attempting to get a basic ECMAScript parser working, and found a complete ANTLR grammar for ECMAScript 3, which appears to compile ok and produces the appropriate Lexer/Parser/Walker Java files. (Running inside ANTLR IDE plugin for Eclipse 3.5) However, when actually trying to use it with some simple test code (following guide on ANTLR wiki), it just hangs when trying to create the parser: CharStream MyChars = new ANTLRFileStream(FileName); // FileName is valid ES3Lexer MyLexer = new

ANTLR parser hanging at proxy.handshake call

我只是一个虾纸丫 提交于 2020-01-02 05:14:05
问题 I am attempting to get a basic ECMAScript parser working, and found a complete ANTLR grammar for ECMAScript 3, which appears to compile ok and produces the appropriate Lexer/Parser/Walker Java files. (Running inside ANTLR IDE plugin for Eclipse 3.5) However, when actually trying to use it with some simple test code (following guide on ANTLR wiki), it just hangs when trying to create the parser: CharStream MyChars = new ANTLRFileStream(FileName); // FileName is valid ES3Lexer MyLexer = new

Is JavaScript's double equals (==) always symmetric?

蓝咒 提交于 2019-12-30 01:35:09
问题 There are many cases in which JavaScript's type-coercing equality operator is not transitive. For example, see "JavaScript equality transitivity is weird." However, are there any cases in which == isn't symmetric ? That is, where a == b is true and b == a is false ? 回答1: In Javascript, == is always symmetric. The spec says: NOTE 2 The equality operators maintain the following invariants: A != B is equivalent to !(A == B) . A == B is equivalent to B == A , except in the order of evaluation of

Is JavaScript's double equals (==) always symmetric?

谁说胖子不能爱 提交于 2019-12-30 01:35:09
问题 There are many cases in which JavaScript's type-coercing equality operator is not transitive. For example, see "JavaScript equality transitivity is weird." However, are there any cases in which == isn't symmetric ? That is, where a == b is true and b == a is false ? 回答1: In Javascript, == is always symmetric. The spec says: NOTE 2 The equality operators maintain the following invariants: A != B is equivalent to !(A == B) . A == B is equivalent to B == A , except in the order of evaluation of

how to get object's [[DefaultValue]]

蓝咒 提交于 2019-12-25 09:28:04
问题 according to ecma262-3 8.6.2.6 [DefaultValue] http://bclary.com/2004/11/07/#a-8.6.2.6 now i want to get the [[DefaultValue]] of [ ] so according to ecma,like this: When the [[DefaultValue]] method of O is called with hint Number, the following steps are taken: 1. Call the [[Get]] method of object O with argument "valueOf". [ ].valeOf() => [ ]//itself 2. If Result(1) is not an object, go to step 5. [ ] is an object 3. Call the [[Call]] method of Result(1), with O as the this value and an empty

Why are anonymous function expressions and named function expressions initialized so differently?

老子叫甜甜 提交于 2019-12-21 17:20:04
问题 I'm looking at section 13 or the ECMAScript specification (v. 5). An anonymous function expression is initialized as follows: Return the result of creating a new Function object as specified in 13.2 with parameters specified by FormalParameterListopt and body specified by FunctionBody. Pass in the LexicalEnvironment of the running execution context as the Scope. Pass in true as the Strict flag if the FunctionExpression is contained in strict code or if its FunctionBody is strict code. this

When did all browsers start supporting the String.replace(regexp, replacement_function)?

落花浮王杯 提交于 2019-12-18 19:01:56
问题 According to the 6th Edition of JavaScript: The Definitive Guide (Flanagan, 2011): ECMAScript v3 specifies that the replacement argument to replace() may be a function instead of a string. I'm looking at some code written in 2005, where a complicated workaround has been used to replace parts of a string. The comments for the code clearly indicate that it originally used the functional replace() method but that the workaround was necessary for cross-browser compatibility. ECMAScript v3 came

JavaScript Closures - Using the ECMA Spec, please explain how the closure is created and maintained

Deadly 提交于 2019-12-18 11:43:00
问题 I'm reading about JavaScript closures. I'm familiar with Execution Contexts, how the Lexical Environment is maintained, and very familiar with Lexical Scoping. I want to know how closures in JavaScript are created and maintained . Sometimes it's hard for me to grasp such important concepts without knowing how it is actually doing it. I know that, according to Wikipedia, a closure is is a function or reference to a function together with a referencing environment—a table storing a reference to

EcmaScript 5 browser implementation

扶醉桌前 提交于 2019-12-18 10:39:28
问题 So Safari and Chrome have started in their betas to implement some ES5 stuff. For instance Object.create is in them. Do any of you know if there is a website that shows the progress made in the browsers? ATM i need to use Object.freeze, and wanted to see which browsers (if any) supported that yet. 回答1: Here's an up to date list for major engines: http://kangax.github.com/es5-compat-table/ 来源: https://stackoverflow.com/questions/2280115/ecmascript-5-browser-implementation