Skip to content

format

typescript
List.forEach(callback)

class: List

description

Iterates through a list.

parameter

param_nametypedescription
callbackCallbackThe callback function.

reture

typedescription
void

code example

typescript
let list = new List<Number>(Number);
list.AddRange([100, 200]);

let otherlist = new List<Number>(Number);
let foreachCallback = (item: Number):void => {
     otherlist.Add(item);
}
// Iterates through the list and adds each element to otherList.
list.forEach(foreachCallback);