Slide 15
Slide 15 text
Dr. Axel Rauschmayer, Ecmanauten.de
Destructuring: arrays
let [x, y] = ['a', 'b'];
// x='a', y='b'
let [x, y, ...rest] = ['a', 'b', 'c', 'd'];
// x='a', y='b', rest = [ 'c', 'd' ]
[x,y] = [y,x]; // swap values
let [all, year, month, day] =
/^(\d\d\d\d)-(\d\d)-(\d\d)$/
.exec('2999-12-31');
15