let's say we have variable a = "value1" and I pass it to a function through an argument called "arg" now inside the function, I'm assigning arg to a value "value2"
my question is : how passing arguments really work? will "value2" be assigned to "arg" or variable "a" or both? does arg get replaced with variable a (during passing)? and what really confuses me is what gets passed, is it the name of the variable or its value ? thank's
var a = "value1";
function myfunc(arg) {
arg="value2";
}
myfunc(a);