Created
December 24, 2019 02:18
-
-
Save cnjimbo/9970909bb15462a0dcb7f0b35d9c6ae8 to your computer and use it in GitHub Desktop.
Javascript: overload Number
This file contains 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
$.extend(Number.prototype, { | |
toString: function(num) { | |
if(isNaN(num)) num = 2; | |
return this.toFixed(num); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment