The Javascript handler getOwnPropertyDescriptor() method traps for Object.getOwnPropertyDescriptor().
Syntax:
getOwnPropertyDescriptor: function(target, property)
Parameters:
target: It represents the target object.
property: It represents the property whose description should be retrieved.
Return:
An object or undefined.
Example:
<!DOCTYPE html> <html> <body> <script> const handler = new Proxy({}, { getOwnPropertyDescriptor: function(a,b) { document.writeln('HELLO WORLD!'); return Object.getOwnPropertyDescriptor(a,b); }}); console.dir(Object.getOwnPropertyDescriptor(handler)); </script> </body> </html>