DEV Community


Discussion on: Passed By Reference Vs. Value In Javascript

steelvoltage profile image
Brian Barbour Author

Wow, the resources I used to learn Javascript never mentioned this at all, thanks for sharing! Very illuminating.

sleeplessbyte profile image
Derk-Jan Karrenbeld

If you try to look this up, most resources will actually mention it incorrectly and even hostile toxic discussion against people who say exactly what I say :(. I only know what I know because I spend quite some time in this implementation in V8 and MRI ruby (and because I had some of this in university).

It also doesn't help that it's really mostly semantics and pedantic, but nomenclature can definitely confusing. I hope you can turn my explanation in a few sentences for the #beginners ❤

Thread Thread
baso53 profile image
Sebastijan Grabar

This exactly. Almost no resource explains this correctly and I think that this is one of the harder things to explain to beginners, but also one of the most important. Obviously, someone who had some C/C++ education would be a bit better at understanding the reasons why this happens, but even those lessons are usually not very good at explaining the differences in detail.

Your explanation on the other hand is pretty good. And good job! :)

Thread Thread
sleeplessbyte profile image
Derk-Jan Karrenbeld • Edited

I guess I'll write an article.

That said, I completely understand where Brian is coming from. It's moreso the lack of writing than that it's super hard. I think Brian did a stellar job giving us the difference of passing an object/array vs primitive, in the practical sense, which is in the end the only thing the beginner will really use.