JavaScript Polyfills
Re-implement built-ins (Array, Function, Promise, Object) to show you understand the spec.
1.Array.prototype.filter
Implement Array.prototype.filter with thisArg support and correct handling of sparse arrays.
2.Array.prototype.map
Implement Array.prototype.map, keeping holes in sparse arrays and supporting thisArg.
3.Array.prototype.reduce
Implement Array.prototype.reduce, including the no-initial-value rules and sparse arrays.
4.Array.prototype.flat
Implement Array.prototype.flat with a depth argument, hole removal and an iterative variant.
5.Function.prototype.bind
Implement Function.prototype.bind with partial application and correct behaviour under new.
6.Promise.all
Implement Promise.all: resolve with every result in order, or reject on the first failure.
7.Promise.any
Implement Promise.any: fulfill with the first success, or reject with an AggregateError.
8.Promise Timeout
Wrap a promise so it rejects with a TimeoutError if it doesn't settle in time, without leaking timers.
9.Promise Implementation
Build a Promises/A+-style MyPromise with then, catch, finally, chaining and thenable adoption.
10.Promise Pool
Build a concurrency-limited task queue: tasks can be added at any time and at most N run at once.
11.Array.prototype.at
Implement Array.prototype.at, including negative indices and the spec's integer coercion rules.
12.Array.prototype.concat
Implement Array.prototype.concat, including sparse arrays and Symbol.isConcatSpreadable.
13.Object.create
Implement Object.create, including null prototypes and property descriptors.
14.Promise.race
Implement Promise.race: settle the same way as the first input to settle.
15.Promise.withResolvers
Implement Promise.withResolvers to create a promise you can settle from outside its executor.
16.Function.prototype.apply
Implement Function.prototype.apply, including array-like argument lists and argument validation.
17.Function.prototype.call
Implement Function.prototype.call without using call, apply or bind.
18.instanceof
Re-implement the instanceof operator by walking the prototype chain.
19.new Operator
Re-implement the new operator: create the object, link the prototype, run the constructor.
20.Promise.allSettled
Implement Promise.allSettled: wait for every input and report each outcome in order.
21.Promise.resolve
Implement Promise.resolve, including promise pass-through and thenable adoption.
22.Array.prototype.square
Add a square() method to every array that returns a new array of squared values.