DEV Community

Master value vs reference in JavaScript

arnav-aggarwal on August 14, 2017

This is taken from my new course, Step Up Your JS: A Comprehensive Guide to Intermediate JavaScript. Feel free to check it out there for interact...
Collapse
 
dobesv profile image
Dobes Vandermeer

Primitives really might be assigned by reference, especially strings. Maybe you have confused JavaScript and Java semantics? JavaScript doesn't really have this primitive value concept in its design even if the underlying compiler might have some optimizations that pass numbers by calling rather than reference.

Collapse
 
arnavaggarwal profile image
arnav-aggarwal

I know I'm not using correct terminology, but I think the way I've explained it is easiest for someone who has very little programming knowledge to understand. Although it's technically not correct it explains the behavior of JavaScript with a simple model.

Collapse
 
arnavaggarwal profile image
arnav-aggarwal

This article is aimed towards beginners looking for their first job. I didn't want to get technically deep. This was meant to encourage people to look into these concepts further.