profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

Destructuring Iterables

Introduction

This was introduced in ES6. Destructuring iterables works on the same principle as arrays.

Syntax

const [x, ...y] = "abc"
console.log(x, y) // a ['b', 'c']

Related