Created
October 11, 2020 11:43
-
-
Save zhongyangxun/17b990820f811bb140d61a0bf7e51c67 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
const robot = { | |
walk() { | |
console.log('walk') | |
} | |
} | |
robot.walk = (function() { | |
const originWalk = robot.walk | |
return function() { | |
originWalk() | |
console.log('jump, walk, jump, walk') | |
} | |
})() | |
robot.walk() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment