is it possible to make something like this ?
let foo = {}, bar = {name : "carl"};
foo.isNotEmpty && "foo is not empty" // FALSE
bar.isNotEmpty && "bar is not empty"; // TRUE
Object.prototype.isNotEmpty = function (){
return Object.keys(_argument_here).length == 0;
}
I don't know how to use object (in this case foo and bar) in my prototype method. Also i want to use it like property not a function, otherwise it looks like this
foo.isNotEmpty() && "foo is not empty"
I prefer first way but if its not possible second way is okay too. Thanks for your help.