Destructuring Assignment (Elegant and Modern):
let [name, age] = ["Bob", 24];
console.log(name); // Outputs: "Bob"
console.log(age); // Outputs: 24
This is the most elegant and modern way to handle this in JavaScript. Destructuring assignment allows you to directly assign values from arrays (or objects) to multiple variables at once. It’s clean, concise, and widely used in modern JavaScript.