Skip to content

Instantly share code, notes, and snippets.

@davefearon
Forked from adamjspooner/gist:1665152
Created January 23, 2012 20:02
Show Gist options
  • Save davefearon/1665253 to your computer and use it in GitHub Desktop.
Save davefearon/1665253 to your computer and use it in GitHub Desktop.
Duck punching JavaScript's Number for toString() typos.
Number.prototype.yoString = function() {
return 'Yo, ' + this + '!';
};
var num = 3;
console.log(num.yoString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment