JavaScript get() method

The Javascript handler get() method traps for getting a property value.

Syntax:

get: function(target, property, receiver) 

Parameters:
target: It represents the target object.
property: It represents the property to be get.
receiver: It represents the proxy or an object which is inherited from the proxy.

Return:
Any value.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var handler = {"Height": 50}  
var height = new Proxy(handler,{  
get: function(a,b) {  
return a[b] + 20  
}})	 
for(var data in height) {  
document.write(data +":")  
document.write(height[data])  
}    
</script>
</body>
</html>

Output:

Height:70
Please Share