From cbfe6fcdfba2897dd8f0b32b526c99993418895b Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 18 Jul 2018 19:57:22 +0300 Subject: [PATCH] Update Value-vs-reference.md --- glossary/Value-vs-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glossary/Value-vs-reference.md b/glossary/Value-vs-reference.md index 8f9b572cc..180f28bab 100644 --- a/glossary/Value-vs-reference.md +++ b/glossary/Value-vs-reference.md @@ -1,5 +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. +When passing a variable by value, a copy of the variable is made, meaning that any changes made to the contents of the variable will not be reflected in the original variable. +When passing a variable by reference, the memory address of the actual variable is passed to the function or variable, meaning that modifying the variable's contents will be reflected in the original variable. +In JavaScript primitive data types are passed by value while objects are passed by reference.