JavaScript之柯里化

//未柯里化
function add(a,b){
    return a + b;
}

//柯里化
function add(y){
	return function(x){
		console.log(y + "+" + x + "=");	
		return y + x;
	}
}

add(2)(1);//1+2 = 3

  

原文地址:https://www.cnblogs.com/johnnyzen/p/7887558.html