wiki/content/20201103112001-destructuring_iterables.md

18 lines
375 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
id: 96e9e4f6-8d7d-4a46-85ef-7cb3eb3804df
title: Destructuring Iterables
---
# Introduction
This was introduced in [ES6](20201030093404-es6). Destructuring
[iterables](20201014092625-javascript_iterables) works on the same
principle as [arrays](20201103111509-destructuring_arrays).
# Syntax
``` javascript
const [x,...y] = 'abc'
console.log(x, y) // a ['b', 'c']
```