ECMAScript 6什么是范围?

时间:2017-12-20 07:02:59

标签: javascript ecmascript-6

我不明白这一刻:

https://tc39.github.io/ecma262/#sec-function-definitions-runtime-semantics-instantiatefunctionobject

With parameter scope.

FunctionDeclaration: function BindingIdentifier(FormalParameters) {FunctionBody}
1. If the function code for FunctionDeclaration is strict mode code, let strict 
be true. Otherwise let strict be false.
2. Let name be StringValue of BindingIdentifier.
3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, scope, strict).
4. Perform MakeConstructor(F).
5. Perform SetFunctionName(F, name).
6. Return F.`

什么等于范围(查看 FunctionCreate 的参数)?在ECMAScript中没有一个关于范围的词。这意味着什么:With parameter scope.

1 个答案:

答案 0 :(得分:1)

这意味着InstantiateFunctionObject算法的参数随后由名称"范围"引用。当应用该过程时,例如将值传递给该值,例如,在

  

fo成为使用参数 InstantiateFunctionObjectf 执行lexEnv的结果。

一般来说,范围是指定义函数的词汇环境,它将关闭。