Hi, I have a general javscript question.
var gimme = function (inputArray) {
var givenArr = inputArray;
var newArr = inputArray.sort(function(a,b){
return a-b;
});
console.log(givenArr);
console.log(inputArray);
};
gimme([2, 3, 1]);
output for both inputArray and givenArr is same, why is that? I thought inputArray will be updated only after the sorting function is called.
Please respond.