I'd like to create a tryParse() static method for Date class. How can I do that?
Date.prototype.tryParse = function (value, result) {
// ... Code ...
};
This adds an instance method, not a static class method. Any idea?
First: you really, really shouldn't. To avoid collisions and incompatibilities, it's really much, to keep that sort of method in a namespace specific to your project:
var myUtils = {};
myUtils.tryParseDate = function(…) {…}
BUT! If you really, really, want to:
Date.tryParse = function(…) {…}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With