StackOverflow - StackOverflow

Array Destructuring Skipping Values

Use object-destructuring instead:

const splittedArr  = [1, 2, 3, 4, 5];

const { 1: second, 4: fifth } = splittedArr;

console.log(second, fifth);

Was this helpful?

Have a different question?

Can't find the answer you're looking for? Submit your own question to our community.

🛎️ Get Weekly OTA Fixes

New answers, vendor issues, and updates — straight to your inbox.