Skip to content

Commit

Permalink
fix: fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZhang123 authored and YuChengKai committed Aug 15, 2018
1 parent b486542 commit 1aa5fd1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions JS/JS-ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ var foo = 1

因为当 JS 解释器在遇到非匿名的立即执行函数时,会创建一个辅助的特定对象,然后将函数名称作为这个对象的属性,因此函数内部才可以访问到 `foo`,但是这个值又是只读的,所以对它的赋值并不生效,所以打印的结果还是这个函数,并且外部的值也没有发生更改。

> ```js
> specialObject = {};
>
> Scope = specialObject + Scope;
>
> foo = new FunctionExpression;
> foo.[[Scope]] = Scope;
> specialObject.foo = foo; // {DontDelete}, {ReadOnly}
>
> delete Scope[0]; // remove specialObject from the front of scope chain
> ```
```js
specialObject = {};

Scope = specialObject + Scope;

foo = new FunctionExpression;
foo.[[Scope]] = Scope;
specialObject.foo = foo; // {DontDelete}, {ReadOnly}

delete Scope[0]; // remove specialObject from the front of scope chain
```

# 闭包

Expand Down

0 comments on commit 1aa5fd1

Please sign in to comment.