loading
open in
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var s = [23, 65, 98, 5];

Array.prototype.myMap = function (callback) {
  var newArray = [];
  /*
  * In here *this* refers to the Array object
  * that called the myMap method
  */
  console.log('the value of *this* is: ', this)
  console.log('the value of *s* is: ', s)

  return newArray;

};

s.myMap(function (item) {
  return item * 2;
});
Native Browser JavaScript