JSFiddle - React, Tailwind, and code Playground
JavaScript
Object.prototype.size = function () {
var size = 0,
key;
for (key in this) {
if (this.hasOwnProperty(key)) size++;
}
return size;
};
var x = {
one: 1,
two: 2,
three: 3
};
if (x.size() === 3) {
document.write("The size is indeed 3");
}