Rest parameters and Arguments | JavaScript

แชร์
ฝัง

ความคิดเห็น • 19

  • @techwithsaket827
    @techwithsaket827 ปีที่แล้ว +2

    First time I am saying thanks to any youtuber. Thanks a lot.

  • @evanc8057
    @evanc8057 ปีที่แล้ว +2

    I have been coding with JS for 4 years and I had no idea that you could do this. So incredibly useful, thank you!

    • @gbbarn
      @gbbarn 6 หลายเดือนก่อน

      Lol I've been coding for Js for close to 2 months and run into the necessity or creating functions that accepts an undefined number of parameters, like params in c# to put arguments into an array, but ended up learning rest parameters, I just love how ambiguous ECMAScript is!!! How did you survive 4 years without the use of rest params xD

  • @kshitijnegi8151
    @kshitijnegi8151 2 ปีที่แล้ว +3

    Its good to learn JS from Telusko as you get to know how he also compares the syntax with JAVA and other languages.

  • @ijajulislam7223
    @ijajulislam7223 2 ปีที่แล้ว

    Awesome content..keep going sir

  • @ewlgirl
    @ewlgirl ปีที่แล้ว

    I have watched many video regarding this ,sir ,you are awesome,i got this concept easily

  • @TinyMaths
    @TinyMaths ปีที่แล้ว

    Just discovering your channel. Thanks for the clear explanation. I was just covering this on the FreeCodeCamp curriculum.
    Nice video background by the way.

  • @-UPH-KRISHNAM
    @-UPH-KRISHNAM 2 ปีที่แล้ว +2

    There is variable length arguments in python too sir, we use *args

  • @Morexod999
    @Morexod999 2 ปีที่แล้ว

    Very good exlpanation, very clearful

  • @MuuoMuumbi
    @MuuoMuumbi 2 วันที่ผ่านมา

    Thanks a lot, sir, and I think the other language you are talking about which uses args is Python,(args and kwargs)

  • @rahul-java-dev
    @rahul-java-dev 2 ปีที่แล้ว

    Short and Clear 🙏🙏

  • @gbbarn
    @gbbarn 6 หลายเดือนก่อน

    Good video! although you forgot to mention that you could rename your rest parameters, instead of ...args you could define it as ...extraElements, for readability sake, one should always do.

  • @santhoshkumar-qi9bc
    @santhoshkumar-qi9bc 2 ปีที่แล้ว

    In JavaScript using 3 dots in clone

  • @Mokhtarmrt
    @Mokhtarmrt ปีที่แล้ว

    What is the difference between these 2 codes as the result is the same:
    function sum(a,b){
    return a+b;
    }
    let result sum(4,5);
    console.log(result);
    AND
    function sum(a,b){
    return a+b;
    }
    console.log(sum(4,5));
    When should i declare a variable and when not? because i saw many of your videos and you declare variables everywhere without telling why we need to declare them.
    When should i use a variable in javascript and when not?

    • @mydoglovesyogurt
      @mydoglovesyogurt ปีที่แล้ว +1

      use a variable when you need to storage the result.

  • @jamilvillones5020
    @jamilvillones5020 ปีที่แล้ว

    params in c#

  • @et-mental-7396
    @et-mental-7396 11 หลายเดือนก่อน +1

    Don't you think this is more efficient:
    function sum(...args) {
    let sum = 0;
    for(let i = 0; i < arguments.length; i++)
    sum = sum + arguments[i];
    return sum;
    }

    • @gbbarn
      @gbbarn 6 หลายเดือนก่อน

      The rule of thumb is that less syntax is almost always better.

  • @N-fc21
    @N-fc21 4 หลายเดือนก่อน

    Thank you sir