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

Поділитися
Вставка
  • Опубліковано 29 гру 2024

КОМЕНТАРІ •

  • @abraaoazevedo5077
    @abraaoazevedo5077 5 років тому +34

    "use your code for good" - loved it

  • @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 6 років тому +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.

  • @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 5 років тому

      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

  • @EminoMeneko
    @EminoMeneko 3 роки тому +2

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

  • @Makebuildmodify
    @Makebuildmodify 5 років тому +48

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

    • @oufcena5092
      @oufcena5092 5 років тому +10

      Get a hint will get you here ;3

  • @sourandbitter3062
    @sourandbitter3062 6 років тому +2

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

  • @pavXX
    @pavXX 6 років тому +45

    Thanks for the explanation. The FCC exercise explanation sucked.

    • @Nyah420
      @Nyah420 5 років тому +10

      Harsh but accurate.

  • @grandpowr
    @grandpowr 7 років тому +2

    Legit the best Javascript teaching series in youtube!

  • @Dandy-94
    @Dandy-94 2 роки тому

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

  • @deepeshsingh923
    @deepeshsingh923 3 роки тому +1

    Straight forward and useful explanation. Pretty helpful.

  • @richardl802
    @richardl802 4 роки тому +3

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

  • @milanm9907
    @milanm9907 6 років тому +3

    Crystal clear, thank you Beau!

  • @herolivesnu
    @herolivesnu 3 роки тому +7

    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".

  • @SanthanamSridharan
    @SanthanamSridharan 5 років тому +2

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

  • @deaddoomed2380
    @deaddoomed2380 Рік тому

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

  • @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.

  • @amwostan6505
    @amwostan6505 3 роки тому

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

  • @user-cool839
    @user-cool839 4 місяці тому

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

  • @alexlions8633
    @alexlions8633 3 роки тому

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

  • @mohd0606
    @mohd0606 3 роки тому +1

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

  • @rnmatsuda
    @rnmatsuda 3 роки тому +3

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

  • @ahmad-ali14
    @ahmad-ali14 5 років тому +2

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

  • @adarshtiwari7395
    @adarshtiwari7395 3 роки тому

    Concise and to the poin! Thanks a ton

  • @d0m2288
    @d0m2288 5 років тому +1

    Concise and informative. Much appreciated.

  • @yufeizhan726
    @yufeizhan726 3 роки тому

    So good. Highly recommended!

  • @miaprivate9742
    @miaprivate9742 3 роки тому

    It was an awesome explanation for rest of my life

  • @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 5 років тому

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

  • @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!!!

  • @khajahussainpathan1064
    @khajahussainpathan1064 4 роки тому

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

  • @CameronPak
    @CameronPak 6 років тому +10

    Now I know how to spread... Woo!

  • @aceborja1656
    @aceborja1656 2 роки тому

    Thank you. Very useful explanation. Great job Beau!

  • @vijaykumarreddyalavala3713
    @vijaykumarreddyalavala3713 5 років тому +1

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

  • @00733adnan
    @00733adnan 4 роки тому

    Awesome. Simple and meaningful.

  • @DColls2488
    @DColls2488 4 роки тому

    GREAT VIDEO FOR ROOKIE CODERS 🙏

  • @daniamsalem
    @daniamsalem 5 років тому

    Very simple explanation, thank you very much

  • @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 UA-cam ! :)

  • @soygeekgirl
    @soygeekgirl 4 роки тому +1

    Genial , super bien explicado!! ..

  • @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~

  • @atifworld
    @atifworld 2 роки тому

    so easily explained, thank you

  • @andrewtcoder
    @andrewtcoder 2 роки тому +1

    Thank you for this video!!!

  • @MrWardo2009
    @MrWardo2009 3 роки тому

    Thank you for doing these videos! Really helped me !

  • @kenbinta2246
    @kenbinta2246 4 роки тому

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

  • @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.

  • @MohsinKhan-wv3ep
    @MohsinKhan-wv3ep Рік тому

    Best video i have ever watched ❤

  • @Akephalos204
    @Akephalos204 2 роки тому

    clear as crystal, thanks

  • @stackdevlopr
    @stackdevlopr Рік тому

    explained beautifully!

  • @teenytinytoons
    @teenytinytoons 3 роки тому

    Beau is my hero!

  • @kodave
    @kodave 7 років тому +1

    Again, thanks for the succinct explanation

  • @eminm6383
    @eminm6383 4 роки тому

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

  • @iVuDang
    @iVuDang 4 роки тому +1

    Thank you, very helpful!

  • @lalaithan
    @lalaithan 5 років тому

    Excellent presentation.

  • @vladislavbarbarii2089
    @vladislavbarbarii2089 6 років тому +1

    Just excellent explanation.Thank you

  • @girlandhercomputer7204
    @girlandhercomputer7204 5 років тому

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

  • @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...

  • @deathknell1970
    @deathknell1970 2 роки тому

    u are a great teacher

  • @lackadaisicallass9041
    @lackadaisicallass9041 7 років тому

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

  • @pepsivanilla93
    @pepsivanilla93 4 роки тому

    Great explanation thanks so much

  • @nebojsapavlovic8031
    @nebojsapavlovic8031 2 роки тому

    Thanks Beau! This I understand.

  • @ih4722
    @ih4722 5 років тому

    Simple yet powerful.

  • @eledorusso
    @eledorusso 3 роки тому

    the best tutorials

  • @BigSmoke-r9w
    @BigSmoke-r9w 10 місяців тому

    Thank you for this Bo

  • @santhoshnatarajan5271
    @santhoshnatarajan5271 5 років тому

    Thank you for the clear explanation

  • @Zakyrie
    @Zakyrie 7 років тому

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

  • @GeorgeEmad
    @GeorgeEmad 6 років тому

    clear and simple and to the point amazing

  • @zeroxcrusher
    @zeroxcrusher 6 років тому

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

  • @diegoavendanohernandez9908
    @diegoavendanohernandez9908 Рік тому

    Thank you much, super clear

  • @israeli_soldier
    @israeli_soldier 3 роки тому

    Excellent video

  • @ahmed_raaphat
    @ahmed_raaphat 2 роки тому

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

  • @hyejungk.6234
    @hyejungk.6234 5 років тому

    amazing tut! appreciate a bunch!

  • @mackynyxz
    @mackynyxz 3 роки тому

    Nice explanation

  • @DelicatelyStunning
    @DelicatelyStunning 7 років тому

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

  • @davidgillis950
    @davidgillis950 2 роки тому

    I don't understand the statment at 5:18 where you explain how you know the difference between the spred opperator and the rest opperator. They look the same to me and seem to be used the same. Perhaps I do not undersatnd what is means to be "passed into an argument as a function." Could someone elaborate?

  • @Moorcheh
    @Moorcheh 5 років тому

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

  • @kevanhaggins6699
    @kevanhaggins6699 3 роки тому

    beau, you're awesome.

  • @LuisMorales-yx8di
    @LuisMorales-yx8di 4 роки тому

    Thanks, really helpful

  • @BlueIceAce2015
    @BlueIceAce2015 6 років тому

    Great explanation, thanks!

  • @WeirdStuffaaaa
    @WeirdStuffaaaa 2 роки тому

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

  • @stavroskefaleas6320
    @stavroskefaleas6320 2 роки тому

    Omg.This is awesome!

  • @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".

  • @jt.633
    @jt.633 3 роки тому

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

  • @Shmack_
    @Shmack_ 7 років тому +1

    Great tutorial thank you!

  • @PhilHiltonUMS
    @PhilHiltonUMS 5 років тому +1

    @2:07 You said the 4th element in the array is ignored "when it spreads it out" so you still get 3 in addThreeNumbers function. Is that true? I suspect is is more that all 4 elements are passed to the function, but since only the first 3 are named a parameters it is ignored within the function. In other words, the spread operator does not ignore it, but the function does, which is after is spreads it out.

    • @oufcena5092
      @oufcena5092 5 років тому +1

      Nope it doesn't work. Here test it yourself
      function add(x, y, z){
      return console.log(x+y+z)
      };
      var args = [6, 1, 2, 3];
      add(...args);
      //Meanwhile this works
      function sum(...theArgs) {
      return theArgs.reduce( (previous, current) => {
      return previous + current;
      });
      };
      console.log(sum(1, 2, 3));

  • @DerekPK
    @DerekPK 4 роки тому

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

  • @FilipPandrc
    @FilipPandrc 3 роки тому +1

    I remember being here, watching this video, doing some exercises. But here I am again, not having a slight idea what spread and rest operators are. fml

  • @egbecharze2780
    @egbecharze2780 2 роки тому

    You are too good.

  • @akagragupta9968
    @akagragupta9968 6 років тому

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

  • @irvingdelgado6426
    @irvingdelgado6426 4 роки тому

    OH great, it's so useful!

  • @justincook8473
    @justincook8473 6 років тому +4

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

    • @oufcena5092
      @oufcena5092 5 років тому

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

  • @KhaledElkhawaga
    @KhaledElkhawaga 7 років тому

    This is super cool.

  • @ohiwantyoutobelieve
    @ohiwantyoutobelieve 2 роки тому

    Excellent, ty

  • @Sergeodessa
    @Sergeodessa 4 роки тому

    thanks for explanation! btw, what about the rest - rest? )

  • @canerates6180
    @canerates6180 7 років тому

    thank you so much! :)

  • @laser1915
    @laser1915 5 років тому

    spread operator also prevents state mutation

  • @oufcena5092
    @oufcena5092 5 років тому

    ...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.

  • @thetravelreels1
    @thetravelreels1 5 років тому

    Could you explain how spread operator is helpful in the second scenario. I was't expecting this half explanation. What's the use of spread operator in the second example. Why we use it then.

    • @oufcena5092
      @oufcena5092 5 років тому

      ...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.

  • @JamesFrederickstech
    @JamesFrederickstech 5 років тому

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

  • @XodiyevAcademy
    @XodiyevAcademy 3 роки тому

    Respeact very very clear is unsdrenstand