Spread and Rest Operators in JavaScript

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • n JavaScript, the spread and rest operators are both represented by three dots (...), but they serve different purposes.
    Spread Operator (...):
    - The spread operator allows an iterable (like an array or a string) to be expanded into individual elements. It is used to split up array elements or object properties.
    - When used with arrays, it can be used to copy an array, concatenate arrays, or pass elements of an array as arguments to a function.
    - With objects, it can be used to create shallow copies of objects, merge objects, or clone objects with new properties.
    Rest Parameter (...):
    - The rest parameter syntax allows you to represent an indefinite number of arguments as an array.
    - It is used in function definitions to capture multiple arguments into a single array parameter.
    - The rest parameter must be the last parameter in a function.

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

  • @a.k.a.s.h7011
    @a.k.a.s.h7011 7 месяцев назад +2

    Varargs in java are similar to rest operator😮

  • @abhisheknavgan6829
    @abhisheknavgan6829 8 месяцев назад +5

    i am currently working on note zipper app and have almost finished it but i am stuck at the redux , coz i want to use redux toolkit and I am currently learning redux toolkit so can you make a dedicated video for redux toolkit and a small sample project on how can we implement it in projects please?

    • @soulsnakers5919
      @soulsnakers5919 8 месяцев назад +2

      Learn Next js u which is a react framework,,U don't need to learn redux,next js will take care of it...

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

      ​@@soulsnakers5919let him learn redux...cause interview will be redux there

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

      ​@@soulsnakers5919how ?

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

      The opinion about Nextjs is just enough is valid. Redux will cause you tons of pain. If you need proper state library, there are tons, my favorite is react-query. If you write good code, then it will be much easier to support.

  • @YugalkishorJha-z2x
    @YugalkishorJha-z2x Месяц назад

  • @bachikoriginals
    @bachikoriginals 3 месяца назад

    I got it very fast

  • @krishnaawasthi5841
    @krishnaawasthi5841 Месяц назад +1

    Can we use concat?

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

    Or use Array.flat over the whole thing, same result.

  • @pranavsawant974
    @pranavsawant974 3 месяца назад

    From where did you learn all these additional things sir pls help and provide resources to learn additional things except the findamentals🙏🏼

  • @gamingnetwork2243
    @gamingnetwork2243 7 месяцев назад +2

    Bhaiya dsa ka video banao for java script

    • @laughingbrick4824
      @laughingbrick4824 7 месяцев назад +1

      Javascript se dsa karne ki jagah Java se hi karlo

    • @Repulsion-kt3tx
      @Repulsion-kt3tx 21 день назад

      ​@@laughingbrick4824 javascript seems easy, heaven for a web developer

    • @RoadsideCoder
      @RoadsideCoder  День назад

      Already bana chuka

  • @Ravi-moq-6589
    @Ravi-moq-6589 5 месяцев назад

    Sir ,should we take this

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

    Can't we use concat instead

    • @SomnathPattnaik
      @SomnathPattnaik 7 месяцев назад +1

      Spread operator is more easy to use while using backend than concat.

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

      redux me ye jyada better rehta hai jab array object me Hoti hai

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

    Bro thinks he did something by making a basic tutorial when thousands already exist

    • @RoadsideCoder
      @RoadsideCoder  7 месяцев назад +2

      Well you gave me a view, so I succeded 😎

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

    No thanks