JavaScript ownKeys() method

The Javascript handler ownKeys() method gives an enum object in return.

Syntax:

ownKeys: function(target)

Parameters: target: It represents the target object.

Return: An enumerable object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var handler = new Proxy({}, {
ownKeys: function(a) {
document.writeln(" My favourite fruits are: ");
return ['apple', 'mango', 'and orange.'];
}});
document.writeln(Object.getOwnPropertyNames(handler));
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com