they said dont do this but I CANT READ

This commit is contained in:
Emily 2020-10-18 18:29:26 +11:00
parent 51d8c63637
commit 994214646a

View file

@ -1 +1,15 @@
// extended prototype stuff
// YEAH IM EXTENDING PROTOTYPES FUCK YOU
String.prototype.toProperCase = function () {
return this.replace(/([^\W_]+[^\s-]*) */g, function (txt) {return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
Array.prototype.random = function () {
return this[Math.floor(Math.random() * this.length)];
};
Array.prototype.remove = function (element) {
const index = this.indexOf(element);
if (index !== -1) this.splice(index, 1);
return this;
};