Тёмный

JavaScript SPREAD OPERATOR in 4 minutes! 📖 

Bro Code
Подписаться 2,2 млн
Просмотров 35 тыс.
50% 1

// 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);

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 26   
@BroCodez
@BroCodez Год назад
// spread operator = ... allows an iterable such as an // array or string to be expanded // into 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);
@swayampattanaik1522
@swayampattanaik1522 7 месяцев назад
greatest takeaway: ``unpacks the elements ``
@nihongo_
@nihongo_ 6 месяцев назад
W
@5upl1an
@5upl1an 2 месяца назад
oh fuck yeah, *spread it*
@Learnng__Simply
@Learnng__Simply Месяц назад
😂 yeah babe
@AngelCodes95
@AngelCodes95 8 месяцев назад
Thanks bro. Very helpful for us visual learners.
@raikashifali1
@raikashifali1 Месяц назад
Big fan 🪭 Sir!! 😅. Big fan
@piotrmazgaj
@piotrmazgaj Месяц назад
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
@xzex2609
@xzex2609 11 месяцев назад
Dear Bro , in the old days we used to use web page console, but if a program is just need a console and doesn't involve Html why you don't use vscode terminal , or output to log .it's way easier . I think by installing node.js we have console on the terminal. since this is your 2nd video teaching JS , and please like the other one make it around DOM , we don't want to play tic tac toe , I personally learn it just for front end web development , I prefer this way than learning flask
@milos2785
@milos2785 2 месяца назад
GREAT! Thanks for explaining!
@ramonremz
@ramonremz 3 месяца назад
ok yeah this is the perfect way of explaining it. thanks!
@DavidWTube
@DavidWTube 5 месяцев назад
Why the Spread Operator isn't three commas I'll never understand. (,,,spread)
@jhoelzeballoszelada4636
@jhoelzeballoszelada4636 4 месяца назад
It looks visualy awful haha
@xzex2609
@xzex2609 11 месяцев назад
When you've said "shallow copy" , I think it's like the shallow copy in python, which changing a copy, will change the original one , but when I pop()ed an item from new array and the original one stayed intact , so I got confused why they are called shallow ? is it mean that other dimensions in the array, are behaving differently like in python. or this shallow has nothing to do with that shallow copy concept we have in python?
@sayalimore1267
@sayalimore1267 6 месяцев назад
It has nothing to do with python. "Creates a shallow copy of an array" actually means to create the copy of elements present inside an iterable. We are not copying the array, but just spreading out or separating the elements without actually affecting the original array as both the arrays have different references pointing out. Hope this helps.
@xzex2609
@xzex2609 6 месяцев назад
thanks , it seems that is a copy of the existing array , independent of the original one.@@sayalimore1267
@adamczarny6482
@adamczarny6482 10 месяцев назад
fucking game changer
@ice-o3i
@ice-o3i Месяц назад
Let comment = Math.random();
@meghanam3948
@meghanam3948 2 месяца назад
Next level
@Gigglesaintlame
@Gigglesaintlame 11 месяцев назад
Start of day 3💪🏼
@siyapandey8799
@siyapandey8799 5 месяцев назад
Useful
@kathikr9360
@kathikr9360 6 месяцев назад
thank you
@ShahidImtiaz-u2u
@ShahidImtiaz-u2u 4 месяца назад
👍
@khalidelgazzar
@khalidelgazzar 9 месяцев назад
So good. Thanks!
@hunin27
@hunin27 10 месяцев назад
ty bro
@baster7537
@baster7537 5 месяцев назад
Thank you soo much bro, You are always best.
Далее
JavaScript REST PARAMETERS in 8 minutes! 🗄
8:06
Просмотров 19 тыс.
Почему?
00:22
Просмотров 283 тыс.
My 10 “Clean” Code Principles (Start These Now)
15:12
Урок 15. JavaScript. Все о Spread и Rest
24:08
The Home Server I've Been Wanting
18:14
Просмотров 169 тыс.
JS Spread Operator: How It Works & Why I Love It
16:31
JavaScript DESTRUCTURING in 8 minutes! 💥
8:41
Просмотров 21 тыс.
Spread and REST operators in Javascript
14:00
Просмотров 55 тыс.
10 React Antipatterns to Avoid - Code This, Not That!
8:55