Reflect

Reflect.deleteProperty

Deletes a property from an object, equivalent to the delete operator but as a function that returns a boolean

Syntax

JavaScript
Reflect.deleteProperty(target, propertyKey)

Parameters

ParameterTypeDescription
targetobjectThe target object
propertyKeystring | symbolThe name of the property to delete

Return Value

A boolean indicating whether the property was deleted

Examples

Basic Usage
const obj: Record<string, number> = { x: 1, y: 2 }
Reflect.deleteProperty(obj, 'x')
console.log(obj) // { y: 2 }
Practical Example
const obj = { a: 1, b: 2, c: 3 }
const deleted = Reflect.deleteProperty(obj, 'b')
console.log(deleted) // true
console.log(obj) // { a: 1, c: 3 }
Advanced Usage
const frozen = Object.freeze({ x: 1 })
console.log(Reflect.deleteProperty(frozen, 'x')) // false

Understanding Reflect.deleteProperty

The Reflect.deleteProperty method in JavaScript deletes a property from an object, equivalent to the delete operator but as a function that returns a boolean. It belongs to the Reflect object and is one of the most widely used methods for working with reflect values in modern JavaScript and TypeScript applications.

The method signature is Reflect.deleteProperty(target, propertyKey). It accepts 2 parameters: target, propertyKey. When called, it returns a boolean indicating whether the property was deleted. Understanding when and how to use deleteProperty() helps you write more expressive, readable code.

Common use cases for Reflect.deleteProperty include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like reflect-set, reflect-has, reflect-defineproperty, enabling you to chain operations together for complex data manipulation pipelines.

Browser support for Reflect.deleteProperty is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.

Browser Compatibility

Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.

Related Methods

More Reflect Methods

Other methods in the Reflect object

Related Tools

More Reflect Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.