Do object references take up extra memory?

后端 未结 2 1894
Happy的楠姐
Happy的楠姐 2021-01-07 19:31

Lets say you have the following complex object:

var object1 = .... // (something complexed)

This takes up x amount of memory i

2条回答
  •  走了就别回头了
    2021-01-07 20:01

    Objects are always passed by reference in JavaScript (see this popular answer). Pointer to an object takes some amount of memory (depends on implementation), of course, but much less than the actual object.

提交回复
热议问题