Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
Where are the callback parameters coming from in a recreation of a .map prototype function?

I'm recreating Javascript's map function and i'm not understanding where these parameters are coming from:

(this[index], index, this)

I understand what this is the array, i understand this[index] is the value, and index is the number that keeps track of the index on iteration, but where is that all coming from when i'm only passing in:

x => x * 5

that's the part i'm confused about and havne't found a good explanation about it online.

Array.prototype.mymap = function(callback) {
    const resultArray = [];
    for (let index = 0; index < this.length; index++) {
        resultArray.push(callback(this[index], index, this));  // confused about these parameters
    }
    return resultArray;
}

const sample = [1,2,3];    
var output = sample.mymap(x => x * 5);    
console.log(output);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!