JSFiddle - React, Tailwind, and code Playground

by irinablue

JavaScript

let a, b, rest;
[a, b] = [10, 20, 30, 40, 50];

console.log(a);
// Expected output: 10

console.log(b);
// Expected output: 20

[a, b, ...rest] = [10, 20, 30, 40, 50];

//console.log(rest);
// Expected output: Array [30, 40, 50]