Created
February 3, 2012 17:48
-
-
Save ojii/1731362 to your computer and use it in GitHub Desktop.
Pythonify Javascript
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
// Array | |
Array.prototype.remove = function(ele){var index = this.indexOf(ele); if(index != -1){this.splice(index, 1);}}; | |
Array.prototype.copy = function(){return this.slice(0);}; | |
// String | |
String.prototype.endswith = function(suffix) {return this.indexOf(suffix, this.length - suffix.length) !== -1;}; | |
String.prototype.startswith = function(prefix) {return this.indexOf(prefix) === 0;}; | |
String.prototype.join = function(seq){return seq.join(this);}; | |
String.prototype.isdigit = function(){return !isNaN(parseInt(this));}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment