# Flow variable changes when it shouldn't

**URL:** <https://discourse.nodered.org/t/flow-variable-changes-when-it-shouldnt/18952>\
**Category:** General\
**Created:** [9 December 2019 14:57 UTC](https://discourse.nodered.org/t/flow-variable-changes-when-it-shouldnt/18952 "2019-12-09T14:57:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [9 December 2019 15:03 UTC](https://discourse.nodered.org/t/flow-variable-changes-when-it-shouldnt/18952/2 "2019-12-09T15:03:23Z")

</div>

Discussed here: [Changes to Context Flow Variable also changes source array it was extracted from](https://discourse.nodered.org/t/changes-to-context-flow-variable-also-changes-source-array-it-was-extracted-from/17070/1)

In short, the pass-by-reference nature of JavaScript means you have to be careful with this sort of thing, and explicitly clone objects if you don't want them being modified.

---

_[View the full topic](https://discourse.nodered.org/t/flow-variable-changes-when-it-shouldnt/18952)._
