* The forEach() method executes a provided function once per child element. * the callback function is invoked with three arguments: * - The current element being processed in the array * - The index of element in the array. * - The array forEach() was called upo
(callback, thisArg)
| 507 | * container.forEach((child, index, array) => { ... }, thisArg); |
| 508 | */ |
| 509 | forEach(callback, thisArg) { |
| 510 | let i = 0; |
| 511 | const children = this.getChildren(); |
| 512 | |
| 513 | const len = children.length; |
| 514 | |
| 515 | if (typeof callback !== "function") { |
| 516 | throw new Error(callback + " is not a function"); |
| 517 | } |
| 518 | |
| 519 | while (i < len) { |
| 520 | callback.call(thisArg ?? this, children[i], i, children); |
| 521 | i++; |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * Swaps the position (z-index) of 2 children |
no test coverage detected