From b7191606dcf4dfd81e127230e658669d409a8bd8 Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Sun, 14 Feb 2016 22:20:20 +0530 Subject: [PATCH] Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `effectvely` → `effectively` --- _posts/en/2016-02-13-know-the-passing-mechanism.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/en/2016-02-13-know-the-passing-mechanism.md b/_posts/en/2016-02-13-know-the-passing-mechanism.md index 5793f88c..39d1763d 100644 --- a/_posts/en/2016-02-13-know-the-passing-mechanism.md +++ b/_posts/en/2016-02-13-know-the-passing-mechanism.md @@ -55,9 +55,9 @@ console.log(me); // 4 : {'partOf' : 'A Group'} ``` -In the case of `myGroup` invocation, we are passing the object `me`. But unlike the example 1 scenario, we are not assigning this `me` variable to any new object, effectvely meaning the object reference value within the `myGroup` function scope still is the original object's reference value and when we are modifying the property within this scope, it is effectively modifying the original object's property. Hence, you get the output from #`7`. +In the case of `myGroup` invocation, we are passing the object `me`. But unlike the example 1 scenario, we are not assigning this `me` variable to any new object, effectively meaning the object reference value within the `myGroup` function scope still is the original object's reference value and when we are modifying the property within this scope, it is effectively modifying the original object's property. Hence, you get the output from #`7`. So does this later case not prove that javascript is pass-by-reference? No, it does not. Remember, *JavaScript passes the reference as value, in case of objects*. The confusion arises as we tend not to understand fully what pass by reference is. This is the exact reason, some prefer to call this as *call-by-sharing*. -*Initially posted by the author on [js-by-examples](https://github.com/bmkmanoj/js-by-examples/blob/master/examples/js_pass_by_value_or_reference.md)* \ No newline at end of file +*Initially posted by the author on [js-by-examples](https://github.com/bmkmanoj/js-by-examples/blob/master/examples/js_pass_by_value_or_reference.md)*