From 88bff99a40a8095b80db5e7492025617685d5036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Wed, 18 Jul 2018 11:16:17 +0200 Subject: [PATCH] add glossary/Value-vs-reference --- glossary/Value-vs-reference.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 glossary/Value-vs-reference.md diff --git a/glossary/Value-vs-reference.md b/glossary/Value-vs-reference.md new file mode 100644 index 000000000..8f9b572cc --- /dev/null +++ b/glossary/Value-vs-reference.md @@ -0,0 +1,5 @@ +### 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.