2

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
2

1 Answer 1

7

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.