Array Destructuring
const colors = ["red", "green", "blue"];

// Destructuring the first two elements
const [firstColor, secondColor] = colors;

console.log(firstColor); // Output: "red"
console.log(secondColor); // Output: "green"

const [firstColor, , thirdColor] = colors;

console.log(firstColor); // Output: "red"
console.log(thirdColor); // Output: "blue"

const colors = ["red", "green", "blue", "purple", "yellow"];

const [firstColor, ...remainingColors] = colors;

console.log(firstColor); // Output: "red"
console.log(remainingColors); // Output: ["green", "blue", "purple", "yellow"]

const colors = ["red", "green"];

const [firstColor = "default", secondColor = "default"] = colors;

console.log(firstColor); // Output: "red"
console.log(secondColor); // Output: "green"

const fruits = [];

const [firstFruit = "default"] = fruits;

console.log(firstFruit); // Output: "default" (no elements in the array)