Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

destructuring an array

let cars = ['ferrari', 'tesla', 'cadillac'];
let [car1, car2, car3] = cars;
console.log(car1, car2, car3); // Prints: ferrari tesla cadillac
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #destructuring #array
ADD COMMENT
Topic
Name
6+1 =