Skip to content

Instantly share code, notes, and snippets.

@tarhunakau
Created April 19, 2019 08:01
Show Gist options
  • Save tarhunakau/8429ea527bc8da77f5d3fef0504d7d6c to your computer and use it in GitHub Desktop.
Save tarhunakau/8429ea527bc8da77f5d3fef0504d7d6c to your computer and use it in GitHub Desktop.
// Добавьте в Function.prototype функцию wrap, которая работает согласно примеру:
function speak(name) {
return `Hello ${name}`;
}
const newSpeak = speak.wrap((original, yourName, myName) => {
const greeting = original(yourName);
return `${greeting}, my name is ${myName}`;
});
newSpeak('Mary', 'Kate'); // Hello Mary, my name is Kate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment