3/28/2017 - 7:40 PM

functional array with currying

functional array with currying

//create a function to iterate through an array passed to  it
//pushing the result of a function passed to it, to each value in newArray

function mapForArray(arr, fn){
  var newArray = [];
  for(i=0; i < arr.length; i ++){
  return newArray;

var arr1 = [1,2,3];

//create a variable equal to a function testing if each item is greater then our limit

var checkPastLimit = function(limiter, item){
  return item > limiter;

//make our new array equal to the array for loop function passing arr1 the above function
//and curry using bind the limter value from checkPastLimit

var arr4  = mapForArray(arr1, checkPastLimit.bind(this, 2));