JSFiddle - React, Tailwind, and code Playground
JavaScript
function defineProperty(object, name, callback){
if(object.prototype){
Object.defineProperty(object.prototype, name, {"get": callback});
}
}
defineProperty(String, "isEmpty", function(){return this.length === 0;});
console.log("".isEmpty, "abc".isEmpty);
defineProperty(String, "isEmptyWithArrow", () => {console.log(this);return this.length === 0});
console.log("".isEmptyWithArrow, "abc".isEmptyWithArrow);