Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var after = function(times, func) {
- return function() {
- if (--times < 1) {
- return func.apply(this, arguments);
- }
- };
- }
- //下面用做用演示
- var function test(){
- console.log("test");
- }
- var res=after(2,test);
- res();
- res();//显示test
Add Comment
Please, Sign In to add comment