This is my code:
var arr1 = [1,2,3];
var fun = function(arr){
var arr2 = [4,5,6];
arr = arr.concat(arr2)
}
fun(arr1)
console.log(arr1)
I am passing arr1 into my fun() function. After fun() does its work, arr1 should look like [1,2,3,4,5,6], but instead it's [1,2,3]. It seems that when I do arr = arr.concat(arr2) I am basically reassigning the value of the parameter in my function, not arr1. How can I get around this issue so that I get the desirable outcome?