Skip to content

Commit

Permalink
doc: split example into two
Browse files Browse the repository at this point in the history
This makes sure the "good" and "bad" examples are split into two.
Otherwise it'll result in an parse error.

PR-URL: #27670
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
  • Loading branch information
BridgeAR committed Jun 17, 2019
1 parent 69af43e commit 705f259
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,23 @@ or be removed in the future.

To avoid these cases, any builtin function overrides should be defined upfront:

<!-- eslint-disable no-redeclare -->
```js
const o = {};
// THROWS: Cannot assign read only property 'toString' of object
o.toString = () => 'string';

// OK
const o = { toString: () => 'string' };

class X {
constructor() {
this.toString = () => 'string';
}
}
// THROWS: Cannot assign read only property 'toString' of object
new X();
```

```js
// OK
const o = { toString: () => 'string' };

class X {
toString = undefined;
Expand Down

0 comments on commit 705f259

Please sign in to comment.