Search
⌘K

Leetcode 2804. Array Prototype ForEach

Implement a polyfill for Array.prototype.forEach that iterates an array in order and invokes a provided callback for each present element with arguments (element, index, array) using an optional thisArg. It should mimic native behavior: no return value, skip holes in sparse arrays, and throw if the callback is not a function.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.