I guess every vendor is supposed to implement it as per the spec
The actual implementation, for example V8 can be a bit complex, refer this answer for a start. You can also refer v8 source in github but it may not be easy to understand only one part in isolation.
Quoted from above answer:
V8 developer here. We have several different implementation techniques
for "builtins": some are written in C++, some in Torque, some in what
we call CodeStubAssembler, and a few directly in assembly. In earlier
versions of V8, some were implemented in JavaScript. Each of these
strategies has its own strengths (trading off code complexity,
debuggability, performance in various situations, binary size, and
memory consumption); plus there is always the historical reason that
code has evolved over time.
ES2015 spec:
- Let O be ToObject(this value).
- ReturnIfAbrupt(O).
- Let len be ToLength(Get(O,
"length")).
- ReturnIfAbrupt(len).
- If IsCallable(callbackfn) is false, throw a TypeError exception.
- If thisArg was supplied, let T be thisArg; else let T be undefined.
- Let A be ArraySpeciesCreate(O, len).
- ReturnIfAbrupt(A).
- Let k be 0.
- Repeat, while k < len
- Let Pk be ToString(k).
- Let kPresent be HasProperty(O, Pk).
- ReturnIfAbrupt(kPresent).
- If kPresent is true, then
- Let kValue be Get(O, Pk).
- ReturnIfAbrupt(kValue).
- Let mappedValue be Call(callbackfn, T, «kValue, k, O»).
- ReturnIfAbrupt(mappedValue).
- Let status be CreateDataPropertyOrThrow (A, Pk, mappedValue).
- ReturnIfAbrupt(status).
- Increase k by 1.
- Return A.
mapwhich was added to the type Array. This function takes a function as a parameter which is then called while looping through the array. The return values of the function calls are then returned in an array.