In MyApp.something.BigObject I have a memory expensive object and I like to do this var theObject = MyApp.something.BigObject;. My question is would that take up double the memory or not?
asked Sep 19, 2011 at 6:45
ilija139
2,9733 gold badges22 silver badges24 bronze badges
-
possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?Andy E– Andy E2011年09月19日 07:03:42 +00:00Commented Sep 19, 2011 at 7:03
-
thanks for that, I wasn't able to find itilija139– ilija1392011年09月19日 11:06:03 +00:00Commented Sep 19, 2011 at 11:06
1 Answer 1
The "equals sign" is the assignment operator. If the RHS is an object, then a reference is assigned to the LHS, it does not clone or copy the object.
So given:
var obj = {};
var b = obj;
both obj and b reference the same object.
answered Sep 19, 2011 at 6:47
RobG
148k32 gold badges180 silver badges216 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-js