I have that code:
function defineProperty(object, name, callback){
if(object.prototype){
Object.defineProperty(object.prototype, name, {"get": callback});
}
}
defineProperty(String, "isEmpty", function(){return this.length === 0;});
and I use it as below:
console.log("".isEmpty, "abc".isEmpty);
and it returns:
true, false
Now, I would like to change function to something like this:
defineProperty(String, "isEmptyWithArrow", () => this.length === 0);
but "this" refers to Window and I do not know how to change it.