+ 2

Is arguments in JS Function a kind of variable?

Hi, I'm little confused about arguments in JavaScript function. I think it works like variables. Am I right?

5th Sep 2020, 2:50 PM
Noob Programmer
Noob Programmer - avatar
3 odpowiedzi
+ 1
Kind of Inside the functional scope, argument works like a variable. When you make changes to an argument, if it is a primitive type, the original variable is not affected. If the argument is object or array, the original variable is affected. If you don't use argument to pass values into function, and use a global variable, changes in functional scope will affect the global variable.
5th Sep 2020, 3:58 PM
Gordon
Gordon - avatar
- 1
the correct term is “parameter” except, it doesnt need to be to be declared in the parenthesis () of the function to be accessible within the function.
5th Sep 2020, 3:10 PM
Logomonic Learning
Logomonic Learning - avatar