TIL how Javascript passes data by value, not by reference
POSTED ON:
TAGS: javascript primitives gif
In JavaScript, primitive types like Number or String are passed by value, not by reference.
If you want to keep the behavior unified across different data types in JavaScript, wrapping values inside an object.
Objects pass by reference. (Which creates a different problem when you're cloning objects!)
Related TILs
Tagged: javascript