Both enumerable. Each descriptor sets enumerable: true.
Keys lists them.Object.keys returns the enumerable own names.
Hide if needed. Set enumerable: false when a property should stay out of key lists.
Compatibility
Browser & Runtime Support
Object.defineProperties() has been part of JavaScript since ES5 and is Baseline Widely available.
✓ Baseline · ES5
Object.defineProperties()
Supported in all modern browsers and Node.js. Also available in Internet Explorer 9+.
99%Modern browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Object.definePropertiesExcellent
Bottom line: Safe to use everywhere modern JavaScript runs. Pair it with getOwnPropertyDescriptor to inspect flags.
Frequently Asked Questions
It defines or updates several properties on one object using a map of property descriptors, then returns that object.
defineProperty() sets one property. defineProperties() sets many properties in a single call.
value is the data. writable controls assignment. enumerable controls key listing. configurable controls whether the property can be deleted or redefined.
No. Use normal assignment for everyday fields. Use descriptors when you need flags like non-writable or non-enumerable.
It returns the same object you passed in as the first argument.