Created
June 9, 2025 02:46
-
-
Save foxbunny/3d462e563ccc4e4dc1c3f957d75ce4a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findEnumerableProperties(obj) { | |
| let enumerableProperties = [] | |
| let descriptors = Object.getOwnPropertyDescriptors(obj) | |
| for (let k in descriptors) | |
| if (descriptors[k].enumerable) | |
| enumerableProperties.push(k) | |
| return enumerableProperties | |
| } | |
| let builtins = [Object, Array, String, Number, Boolean, RegExp, Set, Map, Date, WeakMap, WeakSet, WeakRef, Function, Event, Element] | |
| for (let ctor of builtins) | |
| console.log( | |
| ctor.name, | |
| 'prototype has', | |
| findEnumerableProperties(ctor.prototype).length, | |
| 'enumerable properties' | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment