Forum Discussion
Hi @KTsnap,
There is multiple ways of adding an element to an array. Besides the .push() method, you can use array concatenation:
$value.concat([{"color":null,"default":false,"description":null,"isActive":null,"label":"Active","urls":null,"valueName":"Active"}])
OR
[...$value,{"color":null,"default":false,"description":null,"isActive":null,"label":"Active","urls":null,"valueName":"Active"}]
Regards,
Bojan
HI Bojan,
But it can be dynamic depending on the number of inputs.
its unsure in every run , whether we need to add one element or more than one element to the existing value. How we can implement the same for dynamic values
- bojanvelevski4 years agoValued Contributor
@KTsnap, Concatenating can be on multiple elements. In the square brackets, list the elements that need to be added to the original array. That’s basically joining 2 arrays (array1 which is original, array2 which is array of values that need to be added)