Created
April 19, 2019 08:01
-
-
Save tarhunakau/8429ea527bc8da77f5d3fef0504d7d6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Добавьте в 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