diff --git a/map.js b/map.js new file mode 100644 index 0000000..a1bd1f2 --- /dev/null +++ b/map.js @@ -0,0 +1,30 @@ +// Do NOT use .map, to complete this function. +/* +How map works: Map calls a provided callback function once +for each element in an array, in order, and function constructs a new array from the res . +Produces a new array of values by mapping each value in list +through a transformation function (iteratee). + Return the new array. +*/ + +function map(elements, cb) { + + let resultArr=[]; + + for(let index=0;index