title: Adding new items to an array within a function (Node-Red)
body: <p>I am trying to build a function node that takes this input from a switch node:</p>
  
  <p>topic: "Name of Alarm"
  payload: 1</p>
  
  <p>I am trying to create an array within a function node that pushes the topic inputs, into an array. This is the code I have in my function node so far:</p>
  
  <pre><code>context.outputAlarms = [];
  context.outputAlarms.push(msg.topic);
  msg.payload = context.outputAlarms;
  return msg; 
  </code></pre>
  
  <p>And this is the debug node output:
  C-1A SEL FOR RECV SYS AUTO STP : msg : Object
  { "payload": [ "C-1A SEL FOR RECV SYS AUTO STP" ], "topic": "C-1A SEL FOR RECV SYS AUTO STP", "_msgid": "bbe3efc0.3816a" }</p>
  
  <p>I'm using "context" because from what I understand it is a module that stores data in that certain node. I believe my issue is that the array isn't adding new items, it is overwriting them. Can anyone point me in the right direction?</p>