Can we push a value to an array with just an expression?

I have an array from an node
{{$node["taiga-update"].json["data"]["tags"].join(', ')}}
which outputs
val1,val2,val3

I would like to add an additional value to the array, ideally without having to use a function node

Is it possible to do this with an expression?

Hey @wgicio,

I have never tried, have you already given .push() a go?

I tried experimenting, got some weird results like a .push(“test”) would put the word test into the array a heap of times

It’s pretty easy to crash the browser tab with bad expression code so I thought i would ask, as well as making a post about auto saving :wink:

Ha so it does, If I click in and out of the expression it seems to double the count which is annoying. Best solution I can think of would be to use a set node which seems to work so something like…

Cheers for that, i ended up using a function node and set up the arrays i needed later on.
The extra node seemed like overkill for what i was doing, thought there might had been a simpler way to do it right within the expression

1 Like