JSFiddle - React, Tailwind, and code Playground

by Kumar Sidharth

JavaScript

Array.prototype.myMap = function(callback, thisArg) {
	const anotherArray = [];
  for (let i= 0; i < this.length; i++) {
  	anotherArray.push(callback(this[i], i))
  }
  return anotherArray;
};

console.log(([1,2,3].myMap((e) => e*e)));