Это видео недоступно.
Сожалеем об этом.

...spread operator and rest operator - Beau teaches JavaScript

Поделиться
HTML-код
  • Опубликовано: 21 мар 2017
  • The spread operator (...) spreads out the elements of an array (or iterable object). The rest operator condenses elements. The spread and rest operators are great additions to ES6!
    🔗 Code: codepen.io/beau...
    🔗 More info: developer.mozi...
    Beau Carnes on Twitter: / carnesbeau
    ⭐JavaScript Playlists⭐
    ▶JavaScript Basics: • JavaScript Basics Course
    ▶Data Structures and Algorithms: • Data Structures and Al...
    ▶Design Patterns: • Design Patterns - Beau...
    ▶ES6: • ES6 - Beau teaches Jav...
    ▶Clean Code: • Clean Code - Beau teac...
    -
    We're busy people who learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get great references with our open source community.
    Join our community at freecodecamp.com
    Read great tech articles at medium.freecod...

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

  • @abraaoazevedo5077
    @abraaoazevedo5077 5 лет назад +33

    "use your code for good" - loved it

  • @milleniummoses
    @milleniummoses 6 лет назад +169

    Thank you. These aren't well explained as I was going through the exercises on the website. I came here looking for better understanding.I get them now. Very useful.

    • @pra__bhu
      @pra__bhu 5 лет назад +2

      Totally agree to you man :D..
      Makes much more sense in the video

    • @SanthanamSridharan
      @SanthanamSridharan 5 лет назад

      Same!

    • @azizmejri4850
      @azizmejri4850 5 лет назад

      totally agree ! they didn'te xplain how to copy the array, they just said "const spreaded = ...arr; // will throw a syntax error" which confuse the hell out of u

    • @leeallen2521
      @leeallen2521 4 года назад

      Yep, they said they would go through spread & rest operators in detail later (under basic JS) but they didnt. So glad Im not the only one :)

    • @kelvinmwendwa
      @kelvinmwendwa 2 года назад

      Haha. Same

  • @panthonyy
    @panthonyy 2 года назад +8

    I just found the series "Beau teaches JavaScript," and boy, this is the best JavaScript tutorial series (at least about the topics covered). He is straight to the point, has a clear and clean voice that is easy to understand, and uses a good speech pace. Well, anyway, You got a new sub with notifications on ;)

  • @andreagirardi833
    @andreagirardi833 5 лет назад +79

    Thank you. The FCC exercise had poor explanation and the concept here is well expanded and is clear. Thumbs up!

    • @justaprogrammer3764
      @justaprogrammer3764 5 лет назад +2

      i find the real only curriculum is very confusing at times and speed up. This did also help me.

  • @Makebuildmodify
    @Makebuildmodify 5 лет назад +48

    Why is this video not embedded in the ES6 "rest" and "spread" pages!!??

    • @oufcena5092
      @oufcena5092 4 года назад +10

      Get a hint will get you here ;3

  • @EminoMeneko
    @EminoMeneko 3 года назад +2

    I love this.
    Clear, not excessively long, right to the point.

  • @sourandbitter3062
    @sourandbitter3062 6 лет назад +2

    Love your voice and your straightforward explanations Beau. Very good tutorials.

  • @pavXX
    @pavXX 5 лет назад +45

    Thanks for the explanation. The FCC exercise explanation sucked.

    • @Nyah420
      @Nyah420 5 лет назад +10

      Harsh but accurate.

  • @richardl802
    @richardl802 4 года назад +3

    Great - thanks for your help in understanding this. Useful to see the different use cases explained together.

  • @Ninethepoet
    @Ninethepoet 3 года назад +1

    Thank you thanks you thank you. I was stuck after getting about 50% progress and I needed to redo the whole course because my fundamentals were wrong.

  • @herolivesnu
    @herolivesnu 2 года назад +6

    Wow! You did a great job here in your explanations. I can't just pass without saying "God will continue to bless you with more knowledge".

  • @deepeshsingh923
    @deepeshsingh923 2 года назад +1

    Straight forward and useful explanation. Pretty helpful.

  • @rnmatsuda
    @rnmatsuda 3 года назад +3

    This is extremely helpful and well explained. Thank you, Beau!

  • @mohd0606
    @mohd0606 3 года назад +1

    Thanks, man a quick and concise video. Now the concept was clear. Kudos to you. :)

  • @SanthanamSridharan
    @SanthanamSridharan 5 лет назад +2

    Thank you! This is superb addition to the website tutorial!

  • @amwostan6505
    @amwostan6505 2 года назад

    Thanks Beau. I was stuck on the FCC lesson about REST parameters and this really explained it well.

  • @Amine-wp6de
    @Amine-wp6de 2 года назад

    Thanks for the clear and precise explanation of the 3 dots !

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

    so simple, so useful and so badly explained. this video made it much more clear for me, thanks!

  • @bran8370
    @bran8370 5 лет назад +2

    Great! You explained this well and made it easy to understand. I loved all the examples--really nailed it down for me. Thanks~

  • @milanm9907
    @milanm9907 5 лет назад +3

    Crystal clear, thank you Beau!

  • @MatthewChenIsAwesome
    @MatthewChenIsAwesome 5 лет назад +1

    also a nice tip with spread operator: if you're using react, instead of passing props like:
    ```
    render() {
    const {key, title, summary, imageURL} = this.state;
    return (
    //some stuff
    //other stuff
    }
    ```
    you can do:
    ```
    render() {
    const {...myComponentProps} = this.state;
    return (
    //some stuff
    //other stuff
    }
    ```

    • @oufcena5092
      @oufcena5092 4 года назад

      I still haven't finished JS yet so, maybe I'll get it later. thx tho ;3

  • @ahmad-ali14
    @ahmad-ali14 5 лет назад +2

    this is the best explain for those methods. many thanks.

  • @user-cool839
    @user-cool839 10 дней назад

    Beau, you are the best! Thank you!👍👍👍

  • @grandpowr
    @grandpowr 7 лет назад +2

    Legit the best Javascript teaching series in youtube!

  • @adarshtiwari7395
    @adarshtiwari7395 2 года назад

    Concise and to the poin! Thanks a ton

  • @d0m2288
    @d0m2288 5 лет назад +1

    Concise and informative. Much appreciated.

  • @braulioandre2918
    @braulioandre2918 4 года назад

    When passing elements of an array as arguments to a function, we can also use destructuring assignment:
    function ( [x, y, z] ). In this case when we call the function we don't need to use the spread operator...

  • @buddha0004
    @buddha0004 5 лет назад +3

    Thanks...I'm in the middle of these exercises for the FCC javascript cert now; Sometimes the directions aren't clear to me or confusing...(visual learner, I guess).

  • @phillipscards
    @phillipscards 7 лет назад +2

    Thanks for such a great explanation. Helped me make some sense of it.

  • @vijaykumarreddyalavala3713
    @vijaykumarreddyalavala3713 5 лет назад +1

    Thank you so much for this video. Short and well explained

  • @alexlions8633
    @alexlions8633 2 года назад

    thanks )) you are one of the best teaacher in js in the world

  • @DerekPK
    @DerekPK 4 года назад

    const sum = (x, y, z) => {
    const args = [x, y, z];
    return args.reduce((a, b) => a + b, 0);
    }

  • @CameronPak
    @CameronPak 6 лет назад +10

    Now I know how to spread... Woo!

  • @devjeff3192
    @devjeff3192 4 года назад +1

    Beau is awesome teacher !!! But I couldn't find any video tutorials regarding to ES6 on freeCodeCamp ! But finally found 'em on RUclips ! :)

  • @atifworld
    @atifworld 2 года назад

    so easily explained, thank you

  • @yufeizhan726
    @yufeizhan726 3 года назад

    So good. Highly recommended!

  • @khajahussainpathan1064
    @khajahussainpathan1064 4 года назад

    Thank you, Very good explanation. Understood clearly about Spread and rest Operator

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

    Awesome! Exactly what I was looking for. Clear explanation. Thanks

  • @bk-entertainz7081
    @bk-entertainz7081 3 года назад

    Wow! You made this so simple. THANK YOU!!!

  • @00733adnan
    @00733adnan 3 года назад

    Awesome. Simple and meaningful.

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

    Don't forget to subscribe and remember, USE YOUR CODE FOR GOOD!
    Thanks for the great explanation.

  • @Akephalos204
    @Akephalos204 2 года назад

    clear as crystal, thanks

  • @andrewtcoder
    @andrewtcoder 2 года назад +1

    Thank you for this video!!!

  • @aceborja1656
    @aceborja1656 2 года назад

    Thank you. Very useful explanation. Great job Beau!

  • @rahulgupta6892
    @rahulgupta6892 5 лет назад

    Actually if we pass the extra arguments to the function it is not ignored by the function, rather it will accept those arguments as additional arguments, such function with additional arguments are known as "Varargs".

  • @kenbinta2246
    @kenbinta2246 3 года назад

    Well Explained. I did not have to watch the video twice to understand

  • @oufcena5092
    @oufcena5092 4 года назад

    ...Spread operator allows an array to get more elements.
    arr1.concat(arr2) == [...arr1, ...arr2]; //you can add more elements unlike .concat() function
    ...Rest operator allows a function to get more arguments.
    var multiply = (multiplier, ...args) => args.map( (element) => multiplier * element );
    console.log(multiply(2, 1, 2, 3));
    () means function
    => means return
    map() method creates a new array with the results of calling a function for every array element.

  • @girlandhercomputer7204
    @girlandhercomputer7204 5 лет назад

    Thank you, your explanation is very clear and to the point!

  • @miaprivate9742
    @miaprivate9742 3 года назад

    It was an awesome explanation for rest of my life

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

    explained beautifully!

  • @DelicatelyStunning
    @DelicatelyStunning 6 лет назад

    Thank you for this video. I spent way too long trying to decipher the documentation at MDN.

  • @daniamsalem
    @daniamsalem 4 года назад

    Very simple explanation, thank you very much

  • @MrWardo2009
    @MrWardo2009 3 года назад

    Thank you for doing these videos! Really helped me !

  • @teenytinytoons
    @teenytinytoons 3 года назад

    Beau is my hero!

  • @DColls2488
    @DColls2488 3 года назад

    GREAT VIDEO FOR ROOKIE CODERS 🙏

  • @vladislavbarbarii2089
    @vladislavbarbarii2089 6 лет назад +1

    Just excellent explanation.Thank you

  • @lackadaisicallass9041
    @lackadaisicallass9041 7 лет назад

    Very interesting! Can't wait to use it. Thank you!

  • @jt.633
    @jt.633 2 года назад

    great explanation thank you! although the last one about the rest operator is still confusing

  • @soygeekgirl
    @soygeekgirl 4 года назад +1

    Genial , super bien explicado!! ..

  • @pepsivanilla93
    @pepsivanilla93 3 года назад

    Great explanation thanks so much

  • @nebojsapavlovic8031
    @nebojsapavlovic8031 2 года назад

    Thanks Beau! This I understand.

  • @kodave
    @kodave 7 лет назад +1

    Again, thanks for the succinct explanation

  • @user-kn4oi9oh4i
    @user-kn4oi9oh4i 5 месяцев назад

    Thank you for this Bo

  • @Zakyrie
    @Zakyrie 7 лет назад

    Really nice. I'll be using your videos as a reference point.

  • @WeirdStuffaaaa
    @WeirdStuffaaaa 2 года назад

    I am on my 3rd year of IT degree . I got to know this today

  • @chengjinfei8139
    @chengjinfei8139 2 года назад +1

    in this section we talked about spread out arrays. here's another helpful link for spread object. ruclips.net/video/MpnzQozwLGI/видео.html

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

    Thank you much, super clear

  • @justincook8473
    @justincook8473 6 лет назад +4

    What will happen if you have nested arrays? For example, [[1,2], ["three", "four"]]

    • @oufcena5092
      @oufcena5092 4 года назад

      //return []
      try yourself in dev tools JS console
      var multiply = (multiplier, ...args) => args.map( (element) => multiplier * element );
      console.log(multiply([[1,2], ["three", "four"]]));

  • @deathknell1970
    @deathknell1970 2 года назад

    u are a great teacher

  • @BneiAnusim
    @BneiAnusim 2 года назад

    They should add this video to FreeCodeCamp because they have watered down the explanation on "Use the Rest Parameter with Function Parameters".

  • @laser1915
    @laser1915 4 года назад

    spread operator also prevents state mutation

  • @GeorgeEmad
    @GeorgeEmad 6 лет назад

    clear and simple and to the point amazing

  • @ih4722
    @ih4722 5 лет назад

    Simple yet powerful.

  • @iVuDang
    @iVuDang 4 года назад +1

    Thank you, very helpful!

  • @santhoshnatarajan5271
    @santhoshnatarajan5271 5 лет назад

    Thank you for the clear explanation

  • @israeli_soldier
    @israeli_soldier 2 года назад

    Excellent video

  • @brootalbap
    @brootalbap 5 лет назад +4

    Man the ES6 lessons are all so awfully bad explained on fcc :( Thanks so much for the explanation that helped a bit :(

    • @whathefuckisthis
      @whathefuckisthis 4 года назад

      @@MasterofLightning totally, i thought i was going crazy. glad it's not just me

  • @eledorusso
    @eledorusso 2 года назад

    the best tutorials

  • @zeroxcrusher
    @zeroxcrusher 5 лет назад

    Thanks! ES6 course is so badly made, so this helps.

  • @grantlineful
    @grantlineful 3 года назад

    Great explanation! Thank you.

  • @eminm6383
    @eminm6383 4 года назад

    Great, clear explanation. Well done. 🙏 thnaks a lot

  • @MohsinKhan-wv3ep
    @MohsinKhan-wv3ep 9 месяцев назад

    Best video i have ever watched ❤

  • @lalaithan
    @lalaithan 5 лет назад

    Excellent presentation.

  • @LuisMorales-yx8di
    @LuisMorales-yx8di 4 года назад

    Thanks, really helpful

  • @JamesFrederickstech
    @JamesFrederickstech 4 года назад

    makes a little more sense but I'm still on shaky legs here. will keep working with these operators until the lightbulb goes off.

  • @mackynyxz
    @mackynyxz 3 года назад

    Nice explanation

  • @Moorcheh
    @Moorcheh 4 года назад

    VERY fluid explanation thanks FCC! Btw the excersizes' explanation needs a change!

  • @stavroskefaleas6320
    @stavroskefaleas6320 2 года назад

    Omg.This is awesome!

  • @JavedBaloch786
    @JavedBaloch786 2 года назад

    To convert string to array
    let str = "Hello";
    let x = [...str];

  • @Shmack_
    @Shmack_ 6 лет назад +1

    Great tutorial thank you!

  • @hyejungk.6234
    @hyejungk.6234 5 лет назад

    amazing tut! appreciate a bunch!

  • @BlueIceAce2015
    @BlueIceAce2015 5 лет назад

    Great explanation, thanks!

  • @akagragupta9968
    @akagragupta9968 5 лет назад

    well thank you so much , I was earlier just so confused now I am clear

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

    Thank you!

  • @XodiyevAcademy
    @XodiyevAcademy 3 года назад

    Respeact very very clear is unsdrenstand

  • @kevanhaggins6699
    @kevanhaggins6699 3 года назад

    beau, you're awesome.

  • @SwietyPatryk
    @SwietyPatryk 3 года назад

    It seems to be a mistake as arr1.concat(arr2) will return [0, 1, 2]. It should be arr1 = arr1.concat(arr2) to return [0, 1, 2, 3, 4, 5]

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

    Excellent, ty

  • @solaraproject3614
    @solaraproject3614 10 месяцев назад

    Thank you

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

    You are too good.