As someone who is new to programming, I've been struggling to understand how parameters and arguments work behind the scenes. For example:
function changeStuff(a) {
return a = a * 10;
}
var num = 10;
console.log(changeStuff(num)); //prints 100
console.log(num); //prints 10
When I use the changeStuff
function, how exactly does JavaScript pass the variable num into the parameter a? Is it performing something like a = num
internally?
I hope my question isn't too basic or silly.