JavaScript set() method

The Javascript handler set() method creates a collection of unique items.

Syntax:

set: function(target, property, value, receiver)

Parameters:
target: It represents the target object.
property: It represents the name or value of the property.
value: It represents the new of the property.
receiver: It represents the proxy itself.

Return:
Boolean.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var handler = { foo: 1 };  
var d = new Proxy(handler, {  
set: function(a,b,c,d) {  
document.writeln ('Hello World!');  
a[b] = c.toUpperCase();  
}});  
d.foo = 'Howz U?';  
document.writeln(handler.foo);  
</script>  
</body>
</html>

Output:

Hello World! HOWZ U?
Please Share