defineProperty

fun defineProperty(target: Any, propertyKey: PropertyKey, attributes: TypedPropertyDescriptor<*>): Boolean(source)

Adds a property to an object, or modifies attributes of an existing property.

Parameters

target

Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.

propertyKey

The property name.

attributes

Descriptor for the property. It can be for a data property or an accessor property.