# Context store and array

**URL:** <https://discourse.nodered.org/t/context-store-and-array/23261>\
**Category:** General\
**Created:** [18 March 2020 09:34 UTC](https://discourse.nodered.org/t/context-store-and-array/23261 "2020-03-18T09:34:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 March 2020 14:16 UTC](https://discourse.nodered.org/t/context-store-and-array/23261/5 "2020-03-18T14:16:12Z")

</div>

When you read from context you are getting a reference to the object held in context. If you modify it, you are modifying the object held in context.

If you want to modify it without modifying what is held in context, then you need to clone it.

> [@Global context mutability](https://discourse.nodered.org/t/global-context-mutability/22407/2):
>
> JavaScript passes objects by reference and we don't automatically clone them for you for performance reasons. If you want to modify the object without affecting context, you have to clone it or rebuild it.

---

_[View the full topic](https://discourse.nodered.org/t/context-store-and-array/23261)._
