push

Push adds an element to the array.

{% json arr_1 %}
  [1,2,3,4]
{% endjson %}

{% assign el = 5 %}
{% push arr_1, el %}

{{arr_1 | log }}

Above code logs [1,2,3,4,5]

Last updated