user3753974
user3753974

Reputation: 71

How does method Object.defineProperty prevents properties from rewriting

How does Object.defineProperty works for rewriting props. Is it implemented using js mechanisms (Is it possible to implement the same functionality using js ?)?

Upvotes: 2

Views: 94

Answers (1)

Bergi
Bergi

Reputation: 664196

How does Object.defineProperty works for rewriting props.

By accessing the internal definition of the property (called "property attributes" in the spec).

Is it implemented using js mechanisms, and is it possible to implement the same functionality using js?

No. Object.defineProperty is a primitive building block of the language.

Upvotes: 1

Related Questions