# Issues with variables

**URL:** <https://discourse.nodered.org/t/issues-with-variables/71121>\
**Category:** General\
**Tags:** function-node\
**Created:** [23 November 2022 15:03 UTC](https://discourse.nodered.org/t/issues-with-variables/71121 "2022-11-23T15:03:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 November 2022 15:16 UTC](https://discourse.nodered.org/t/issues-with-variables/71121/2 "2022-11-23T15:16:40Z")

</div>

I think that you have fallen foul of a JavaScript oddity that only applies to context variables _in memory_. If you tried the same thing with some other storage mechanisms, you would get the result you expect.

The reason is that assigning in-memory objects happens _by reference_ - in other words, it is the SAME data, not a copy.

If you want to be certain that you have a copy, there is a `RED` utility method for that - it does a shallow copy. Sorry, I can't remember the method name off the top of my head.

---

_[View the full topic](https://discourse.nodered.org/t/issues-with-variables/71121)._
