Answers for "javascript currying stack overflow"

0

javascript currying stack overflow

let doTheHardStuff = function(x) {
  let z = doSomethingComputationallyExpensive(x)
  return function (y){
    z + y
  }
}

We could call this function once, 
then pass around the result to be used in lots of places, 
meaning we only do the computationally expensive stuff once:

let finishTheJob = doTheHardStuff(10)
finishTheJob(20)
finishTheJob(30)
Posted by: Guest on July-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language