Rest parameters and Arguments | JavaScript

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

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

evanc
Автор

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

techwithsaket
Автор

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

kshitijnegi
Автор

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

-UPH-KRISHNAM
Автор

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

ewlgirl
Автор

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

TinyMaths
Автор

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

MuuoMuumbi
Автор

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.

gbbarn
Автор

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;
}

et-mental-
Автор

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?

Mokhtarmrt