Probably it is safer to add the final flow.set
anyway. As you probably know there are mutating x non-mutating methods array methods. You may get confused if using non-mutating methods, like below:
flow.set("storedarray",["1","2"]);
//other code
temp = flow.get("storedarray");
node.warn(temp.concat("3"));
node.warn(temp.slice(1));
msg.payload = temp;
return msg;
There is a similar discussion here:
I've been hitting my head against a certain code behavior which I believe`I've captured in the following flow.
I'm trying to do something quite simple.
I have two global arrays (flow arrays): current_array and last_array
I want to be able to update the current_array one element at a time, and at certain times, I would like to copy the current_array to the last_array.
This works fine when I update the entire array like this:
flow.set("current_array", [1,2,3,4,5,6]);
but it fails (sometimes)…
1 Like