Skip to content

Instantly share code, notes, and snippets.

@mattbasta
Forked from potch/call-me-maybe.js
Last active August 17, 2022 20:43
Show Gist options
  • Save mattbasta/6754532 to your computer and use it in GitHub Desktop.
Save mattbasta/6754532 to your computer and use it in GitHub Desktop.
// this is crazy
Function.prototype.callMeMaybe = function(ctx) {
if (Math.random() > .5) {
return this.apply(ctx, Array.prototype.slice.call(arguments, 1));
}
};
function square(n) {
return n * n;
}
// so here's my number
square.callMeMaybe(null, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment