Browse Source

Mention object destructuring

pull/2/head
Luke Childs 8 years ago
parent
commit
84869ce673
  1. 10
      README.md

10
README.md

@ -32,6 +32,16 @@ div instanceof window.HTMLElement
// true
```
Because `window` is just a normal JavaScript object it can be used more efficiently with object destructuring.
```js
const { document } = new Window();
document.body.innerHTML = '<div class="foo">Hi!</div>';
document.body.querySelector('.foo').textContent;
// Hi!
```
## License
MIT © Luke Childs

Loading…
Cancel
Save