Skip to content

Instantly share code, notes, and snippets.

@alkayesdev
Created October 25, 2018 16:09
Show Gist options
  • Select an option

  • Save alkayesdev/2a41d740fb6f8e8d29c67d857f4c1e54 to your computer and use it in GitHub Desktop.

Select an option

Save alkayesdev/2a41d740fb6f8e8d29c67d857f4c1e54 to your computer and use it in GitHub Desktop.
function generator
function generate (type){
if(type==="plus"){
return (a,b)=>a+b;
}
else if (type=="minus"){
return (a,b)=>a-b;
}
else if (type === "multiply"){
return (a,b)=>a*b;
}
else if (type === 'divide'){
return(a,b)=>a/b
}
}
var x = generate('divide');
console.log(x(12,6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment