首页 > 代码库 > js题集22

js题集22

1.实现warp

function speak(name){

   return "Hello " + name;

}

 

speak = speak.wrap(function(original, yourName, myName){

   greeting = original(yourName);

   return greeting + ", my name is " + myName;

})

 

var greeting = speak("Mary", "Kate");

js题集22