A general question on JavaScript. If I have a function which modifies an array, such as:
var some_array = [];
function a_function(input, array){
    //do stuff to array
    return array;
}
In most languages:
var some_array = [];
some_array = a_function(input, some_array);
console.log(some_array);
works, however in js the below works as well:
var some_array = [];
a_function(input, some_array);
console.log(some_array);
Is this correct and how is this working?
some_arrayandarrayare the exact same in-memory array.