JS Interview - Function Parameters - Question 4

preview_player
Показать описание
This is the fourth episode in the JavaScript Interview Questions series.

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

A bit of vocabulary:
- parameter: the thing you declare in a function
-argument: the values you pass when you call the function.
function f(a, b){} // a and b are the parameters of f
f(1, 2); // f is called with the arguments 1 and 2.

They are often mixed-up.

thomasburette
Автор

When I was trying to solve this problem, I had a look on "arguments" object article in MDN and found there a ".callee" property which was amazing at that moment (I hadn't watched your solution yet :) ).


So for me "arguments.callee.length" worked instead of "f.length" . That's so great when you solve the problem before watching the video. Now I know 2 ways to do this and wanted to share this way of solving with the people who will be reading the comments :)


Thank you!

tezzarida
Автор

Amazing channel Steve. Loving this interview series. Very helpful and informative!

ConorBailey
Автор

1:59 The "arguments" is only available in functions that are declared with "function" - either named or anonymous
A.K.A. you can't use "arguments" inside an arrow function

avi
Автор

Respected Steve, Great Work, I used arrow function and saw that argument.length property did not work with arrow function. than I used with function it worked.

ahmedmoeed
Автор

3:18 hahaha :D
btw I have learned a lot from you. Thank u :)

omikabira
Автор

if is possible use spread operator instead arguments?

leonardolgel
Автор

Great video as always Steve. Can you think of a use case for using f.length when you can just count how many parameters have been used and type that number instead?

RedEyedJedi
Автор

hi i got Uncaught RangeError: Maximum call stack size exceeded
when i tried if else in a http request !!!

mnageh-bomm
Автор

Thank you so much for the helpful videos
May I ask for the vscode font you use to the make the triple equal looks stylish like in this video?
Thank you :)

abdelrahman
Автор

How would you do it if you had to use arrow function instead?

demian