DEV Community

Discussion on: Mostly asked JavaScript conceptual questions in interviews

Collapse
 
andyc profile image
Andy Cormack • Edited

Hi, I have to disagree with you about pass by reference, objects and arrays are indeed passed by reference in function parameters. Simply because you can reassign what the local variable inside the function points to does not invalidate the fact that you can mutate the passed external object or array from inside that function.

This is a potentially dangerous "gotcha", and while you do state that you can mutate the object's properties, you need to acknowledge that they are passed by reference.

Don't let this detract from your article overall though, I enjoyed the read and these are definitely useful ones to learn fully, not just for the interview stage, but for understanding the fundamentals of how javascript works. So thank you for the time and effort you put in!