JavaScript defineProperty() method

The Javascript handler defineProperty() method defines the new properties and often modifies the existing properties.

Syntax:

defineProperty: function(target, property, descriptor)

Parameters:
target: It represents the target object.
property: It represents the property description.
descriptor: It represents the property being defined or modified.

Return:
Boolean.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var handler = {};
var define = new Proxy(handler, {
defineProperty: function(a,b,c) {
document.writeln('HELLO WORLD!');
return Object.defineProperty(a,b,c);
}
});
Object.defineProperty(define, 'bar', {} );
</script>
</body>
</html>