Why does the first function not modify the original array like the second function does?
var a= [3, 4, 5];
function doesNothing(a) {
a=[1,1,1];
}
function doesSomething(a) {
a.push(6);
}
doesNothing(a);
console.log(a); // [3,4,5] not [1,1,1]
doesSomething(a);
console.log(a); //[3,4,5,6]
ais a new value. It is not the sameaas outside the function.