diff --git a/index.js b/index.js index 93cd82f..ef12d04 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,13 @@ var myEach = require('./myEach'); -var myMap = require('./myEach'); -var myReduce = require('./myEach'); +var myMap = require('./myMap'); +var myReduce = require('./myReduce'); /* ********************************************************************* You can edit this file It will make use of your code in myEach.js, myMap.js and myReduce.js To run it on the console do: `node index.js` ***********************************************************************/ -var numArray = [0,1,10,100,1000]; +//var numArray = [0,1,10,100,1000]; /* myEach */ @@ -17,17 +17,37 @@ var numArray = [0,1,10,100,1000]; // console.log('inside myEach', element, index, arr); // }); +// function myEach(arr,callback){ +// for(var i=0;i 0) { + + +for( ;i < arr.length ;i++){ + result= callback(result, arr[i],i,arr); +} +} +return result; } /*