Skip to content

Commit

Permalink
Update optional chaining documentation with deletion change (#2145)
Browse files Browse the repository at this point in the history
* docs: add documentation regarding deletion and optional chainging

Prior to babel version 7.8, deleting a property with a nullish base
returned undefined. The default behavior in 7.8+ returns true.

* docs: Update "delete" verb tense for consistency

* Update plugin-proposal-optional-chaining.md

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
mpaarating and nicolo-ribaudo committed Jan 10, 2020
1 parent b5981b7 commit 95e45e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/plugin-proposal-optional-chaining.md
Expand Up @@ -86,6 +86,18 @@ new Test?.(); // test instance
new exists?.(); // undefined
```
### Deleting deeply nested properties
```js
const obj = {
foo: {
bar: {}
},
};

const ret = delete obj?.foo?.bar?.baz; // true
```
## Installation
```sh
Expand Down

0 comments on commit 95e45e5

Please sign in to comment.