Skip to content

Instantly share code, notes, and snippets.

@b2977053
Last active November 12, 2019 02:07
Show Gist options
  • Save b2977053/b36bc560dd3bd0e9ab8c5ae8c5ec6548 to your computer and use it in GitHub Desktop.
Save b2977053/b36bc560dd3bd0e9ab8c5ae8c5ec6548 to your computer and use it in GitHub Desktop.
改版(〃∀〃) 保哥出作業 JS
(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