JS: Object.prototype.propertyIsEnumerable 👎
obj.propertyIsEnumerable(key)-
Return
trueif key is a own key and Enumerable. Else,false.console.log({ "p": 4 }.propertyIsEnumerable("p")); 🛑 warning:
Object.prototype.propertyIsEnumerablewon't work if a object has a property of that name. Better is to use Reflect.getOwnPropertyDescriptor.// demo, problem of propertyIsEnumerable when a object has that property name. const jj = { "pp": 4, "propertyIsEnumerable": ((x) => x + " haha") }; console.assert(jj.propertyIsEnumerable("pp") === "pp haha");