tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code04:55

JavaScript SPREAD OPERATOR in 4 minutes! 📖

Bro Code ↗

From the creator

// spread operator = ... allows an iterable such as an // array or string to be expanded // in to separate elements // (unpacks the elements) // ------------- EXAMPLE 1 ------------- let numbers = [1, 2, 3, 4, 5]; let maximum = Math.max(...numbers); let minimum = Math.min(...numbers); console.log(maximum); // ------------- EXAMPLE 2 ------------- let username = "Bro Code"; let letters = [...username]; console.log(letters); // ------------- EXAMPLE 3 ------------- let fruits = ["apple", "orange", "banana"]; let vegetables = ["carrots", "celery", "potatoes"]; let foods = [...fruits, ...vegetables, "eggs", "milk"]; console.log(foods);

Published 2023-11-07 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code