CodesJava

Easy learning with example program codes

JavaScript has() method

The Javascript handler has() method hides the specified property.

Syntax:

has: function(target, property) 

Parameters:
target: It represents the target object.
property: It represents the property to be hide.

Return:
Boolean.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var handler={x:10}  
var display = new Proxy(handler, {  
has: function(a,b) {  
document.writeln(b);  
return false;  
}  
});  
document.writeln('Value:' in display);   
</script>
</body>
</html>

Output:

Value: false
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status