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 <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Refael Ackermann (רפאל פלחי) <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
  • 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.