Say for example you have a function like below
var value = 1;
function test(myVar) {
myVar = 2
}
test(value)
console.log(value)
//prints out 1
Now, I have read that there are two things that happen in JS functions.
1) Javascript passes primitives by value. When "value" is passed as an argument to test(), a copy is created that is separate from the global variable "value". Therefore the "myVar" is a separate variable from "value"
2) Parameters in JS functions are really just local variables to the function. So, the "myVar" parameter has scope only inside of the test() function.
I know both statements are true, but which one of these statements causes console.log(value) to print out 1