# [[Iterating through elements in an array in js]] You might want to iterate through elements in an array so that you can transform or catalog each element in some way. In [[JavaScript|js]], you can do that using `.forEach()`: ```js const options = app.plugins.plugins.dataview.api .pages(`"study-materials/${type}"`) let result = ""; options.forEach((option) => { result += `- ${option.file.link}: ${option.time_required}\n\n` }) ``` In this example, you're taking an array of objects (pages), `options`, and adding a string to `result` based on each element (`option`) in that array. This is a code snippet using the [[Obsidian Dataview]] plugin.