format
typescript
List.forEach(callback)class: List
description
Iterates through a list.
parameter
| param_name | type | description |
|---|---|---|
| callback | Callback | The callback function. |
reture
| type | description |
|---|---|
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);