Question: are arrays passed by reference in javascript?
Answer: JavaScript Arrays: Value vs Reference This happens because arrays are reference types in JavaScript. That means that if you assign an array to a variable or pass an array to a function, it is the reference to the original array that is copied or passed, not the value of the array.