CodesJava

Easy learning with example program codes

JavaScript getPrototypeOf() method

The Javascript handler getPrototypeOf() method traps for the internal method.

Syntax:

getPrototypeOf(target)

Parameters:
target: It represents the target object.

Return:
An object or null.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var handler = {};  
var arr = new Proxy(handler, {  
getPrototypeOf(arg) {  
return Array.prototype;  
}  
});  
document.write(  
arr instanceof Array    
);  
</script>
</body>
</html>

Output:

true
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status