Merge pull request #810 from 11un/patch-14

typo + add link to relevant chapter
This commit is contained in:
Ilya Kantor 2019-02-21 18:49:55 +03:00 committed by GitHub
commit afc268cca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
The method can take all enumerable keys using `Object.keys` and output their list. The method can take all enumerable keys using `Object.keys` and output their list.
To make `toString` non-enumerable, let's define it using a property descriptor. The syntax of `Object.create` allows to provide an object with property descriptors as the second argument. To make `toString` non-enumerable, let's define it using a property descriptor. The syntax of `Object.create` allows us to provide an object with property descriptors as the second argument.
```js run ```js run
*!* *!*
@ -27,3 +27,5 @@ alert(dictionary); // "apple,__proto__"
``` ```
When we create a property using a descriptor, its flags are `false` by default. So in the code above, `dictionary.toString` is non-enumerable. When we create a property using a descriptor, its flags are `false` by default. So in the code above, `dictionary.toString` is non-enumerable.
See the the chapter on [Property flags and descriptors](http://javascript.info/property-descriptors) for review.