1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-25 19:22:21 +00:00

Merge pull request #80 from howiefh/patch-1

array和object两章勘误
This commit is contained in:
Ruan YiFeng 2015-08-28 17:24:21 +08:00
commit 965a2dbb49
2 changed files with 1 additions and 13 deletions

View File

@ -31,7 +31,7 @@ Array.from({ 0: "a", 1: "b", 2: "c", length: 3 });
// [ "a", "b" , "c" ]
```
对于还没有部署该方法的浏览器可以用Array.prototyp.slice方法替代。
对于还没有部署该方法的浏览器可以用Array.prototype.slice方法替代。
```javascript
const toArray = (() =>

View File

@ -145,18 +145,6 @@ person.firstName.name // "get firstName"
上面代码中方法的name属性返回函数名即方法名。如果使用了取值函数则会在方法名前加上get。如果是存值函数方法名的前面会加上set。
```javascript
var doSomething = function() {
// ...
};
doSomething.bind().name
// "bound doSomething"
(new Function()).name
// "anonymous"
```
有两种特殊情况bind方法创造的函数name属性返回“bound”加上原函数的名字Function构造函数创造的函数name属性返回“anonymous”。
```javascript