Question: are variables passed by reference in javascript?
Answer: Javascript always pass by value so changing the value of the variable never changes the underlying primitive (String or number). However, when a variable refers to an object which includes array, the value is the reference to the object.