6 lines
400 B
Markdown
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.
|