Adding data to a static flow variable Array?

Here is my code snippet for initializing my flow variable:

var a = new Array(65);

In a Function Node I want to add the msg.payload to the myArray flow variable until I fill up the array.
How do I write the correct syntax to add it to the Flow variable?

Something like flow.set.push("myArray",msg.payload); ?????


Firstly it is generally recommented to use
var a = [35];
rather than using new Array. Which is easily misunderstood. For example
new Array(35,60);
may not do what you expect. The simplest way to add a new element is probably

a = flow.get("myArray");
flow.set("myArray", a);

If you really want to get it in one statement then
flow.set("myArray", flow.get("myArray").push(msg.payload));

Thanks, works fine!

I just had the same problem. Thanks for the solution @Colin.

But for me only the first solution worked, the

flow.set("myArray", flow.get("myArray").push(msg.payload));

would somehow destroy the array.

Edit1: Funny, but

flow.set("myArray", flow.get("myArray")+1);

does work.