mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 03:26:22 +00:00
474 B
474 B
date | id | title |
---|---|---|
2020-11-03 | 05066fdd-18fe-4762-b836-af35ba1f625b | Destructuring Arrays |
Introduction
Destructuring arrays was introduced in ES6. Iterables can also be destructured via the same principle.
Syntax
const [, year, month, day] =
/^(\d\d\d\d)-(\d\d)-(\d\d)$/
.exec('2999-12-31');
console.log(`${year} ${month} ${day}`) // 2999 12 31