You are here: Home / Topics / Is JavaScript a pass-by-reference or pass-by-value language?

Is JavaScript a pass-by-reference or pass-by-value language?

Filed under: JavaScript Interview Questions on 2022-07-24 08:03:11

The variable's data is always a reference for objects, hence it's always pass by value. As a result, if you supply an object and alter its members inside the method, the changes continue outside of it. It appears to be pass by reference in this case. However, if you modify the values of the object variable, the change will not last, demonstrating that it is indeed passed by value.

About Author:
K
Krishna Sharma     View Profile
Don't lose hope unless you get success.