Last active
November 12, 2019 02:07
-
-
Save b2977053/b36bc560dd3bd0e9ab8c5ae8c5ec6548 to your computer and use it in GitHub Desktop.
改版(〃∀〃) 保哥出作業 JS
This file contains hidden or 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() { | |
window.$ = function(n) { | |
var num="undefined"==typeof n||null===n?0:n; | |
return { | |
add: function(n) { num += n; return this; }, | |
result: function() { return num; } | |
}; | |
} | |
})(); | |
console.log($(1).add(2).add(3).add(99).result()); | |
console.log($(1).add(2).add(3).result()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment