JavaScript SPREAD OPERATOR in 4 minutes! 📖

Поделиться
HTML-код
  • Опубликовано: 10 янв 2025

Комментарии • 36

  • @BroCodez
    @BroCodez  Год назад +13

    // 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 10 месяцев назад +15

    greatest takeaway: ``unpacks the elements ``

  • @weslaycock466
    @weslaycock466 8 часов назад

    Thanks bro grateful this type of education exist and is freely available

  • @1More_Dreamer
    @1More_Dreamer 6 дней назад

    when not even documentation makes me understand, I come here, and leave with pure knowledge

  • @AngelCodes95
    @AngelCodes95 Год назад +8

    Thanks bro. Very helpful for us visual learners.

    • @powpud
      @powpud Месяц назад

      i love you

  • @5upl1an
    @5upl1an 5 месяцев назад +11

    oh fuck yeah, *spread it*

  • @piotrmazgaj
    @piotrmazgaj 5 месяцев назад +2

    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.

  • @milos2785
    @milos2785 5 месяцев назад

    GREAT! Thanks for explaining!

  • @ramonremz
    @ramonremz 7 месяцев назад

    ok yeah this is the perfect way of explaining it. thanks!

  • @feenixtm
    @feenixtm Месяц назад

    Thanks Bro Code! :D

  • @raikashifali1
    @raikashifali1 4 месяца назад +1

    Big fan 🪭 Sir!! 😅. Big fan

  • @khalidelgazzar
    @khalidelgazzar Год назад +1

    So good. Thanks!

  • @xzex2609
    @xzex2609 Год назад

    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 10 месяцев назад +1

      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 10 месяцев назад +1

      thanks , it seems that is a copy of the existing array , independent of the original one.@@sayalimore1267

  • @meghanam3948
    @meghanam3948 6 месяцев назад

    Next level

  • @baster7537
    @baster7537 8 месяцев назад +1

    Thank you soo much bro,
    You are always best.

  • @asdsdfadfsa
    @asdsdfadfsa 2 месяца назад

    3:08 isn't that a deep copy?

  • @DavidWTube
    @DavidWTube 9 месяцев назад

    Why the Spread Operator isn't three commas I'll never understand. (,,,spread)

  • @xzex2609
    @xzex2609 Год назад

    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

  • @kathikr9360
    @kathikr9360 9 месяцев назад

    thank you

  • @siyapandey8799
    @siyapandey8799 8 месяцев назад

    Useful

  • @hunin27
    @hunin27 Год назад

    ty bro

  • @engineeringmentality8249
    @engineeringmentality8249 Месяц назад

    awesome explanations

  • @Nedigital__lol
    @Nedigital__lol Год назад

    Start of day 3💪🏼

  • @adamczarny6482
    @adamczarny6482 Год назад +1

    fucking game changer

    • @powpud
      @powpud Месяц назад

      you too

  • @ShahidImtiaz-u2u
    @ShahidImtiaz-u2u 8 месяцев назад

    👍

  • @nihongo_
    @nihongo_ 9 месяцев назад

    W

  • @ice-o3i
    @ice-o3i 4 месяца назад

    Let comment = Math.random();