From 6a5376bb94f10d262df881226c05699c28cdd139 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 20 May 2019 15:48:42 +0200 Subject: [PATCH] doc: split example into two MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure the "good" and "bad" examples are split into two. Otherwise it'll result in an parse error. PR-URL: https://github.com/nodejs/node/pull/27670 Reviewed-By: Michaël Zasso Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann (רפאל פלחי) Reviewed-By: Daijiro Wachi Reviewed-By: Ujjwal Sharma --- doc/api/cli.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 6e20596462bda6..141e72aa007ba0 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -218,15 +218,11 @@ or be removed in the future. To avoid these cases, any builtin function overrides should be defined upfront: - ```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'; @@ -234,6 +230,11 @@ class X { } // THROWS: Cannot assign read only property 'toString' of object new X(); +``` + +```js +// OK +const o = { toString: () => 'string' }; class X { toString = undefined;