Files
30-seconds-of-code/glossary/Value-vs-reference.md
2018-07-18 11:16:17 +02:00

6 lines
400 B
Markdown

### Value vs reference
When passing by value we pass a copy of actual variables in the function as a parameter.
When passing by reference we pass a memory address of actual variables in function as a parameter ,therefore any modification on parameters inside the function will reflect in the actual variable.
In JavaScript primitive values are passed by value while objects are passed by reference.