On Mon, Dec 13, 2010 at 1:57 PM, Rajat <[email protected]> wrote:

>
> I want to understand why we can change the passed object inside mutate by
> lets say adding more properties to it but not this way where I am redefining
> it as a function object.
>
>
Javascript passes objects "by-reference", but note that it's not the *same*
reference.  So, "obj" is actually a new variable in this scope that happens
to point to the same data that "a" did in the outer scope.

Check out http://snook.ca/archives/javascript/javascript_pass for a more
thorough explanation.

_jason


> I hope my question is clear.
>
> Thanks,
>
> Rajat Mittal
> http://www.lifeinafolder.com
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]<jsmentors%[email protected]>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to