DocsUpdated 18 Oct 2026
Array examples
Getting length of an array
#let myarray = docly.split("1,4,5,6,7,8", ",")#
Array item count: #myarray.length# Looping an array
Loop over the items with for...of:
#for(let item of myarray) {#
The array item is: #item#
#}# Looping with objects
#{ var myobjects = [{ Field1: "first" }, { Field1: "second" }]; }#
#for(let item of myobjects) {#
The array item is: #item.Field1#
#}# Each item is an object, so read its fields with item.Field1. Same applies when using the data-loop attribute.
How to create an array of items
/* ... some code ... */
let items = [];
for(let item of otherArray) {
/* ... some code ... */
items.push({
"Product" : productname,
"Url" : url,
"Price" : itemprice,
"Length" : length
}); /* adds an item to the array */
}