JS: Object .prototype .propertyIsEnumerable 👎
obj.propertyIsEnumerable(key)-
Return
trueif key is a own key and Enumerable. Else,false.console.assert({ dog: 4 }.propertyIsEnumerable("dog")); 🛑 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 = { "dog": 4, "propertyIsEnumerable": () => "haha", }; console.assert( jj.propertyIsEnumerable("dog") === "haha", );