JavaScript construct()

The Javascript handler construct() method intercepts a new operation.


construct: function(target, arguments, newTarget)

Parameters: target: It represents the target object. argumentsList: The list of function parameters. newTarget: It represents the constructor.

Return: Object.


<!DOCTYPE html>
var handler = function(text) {
this.text = text;
var print = new Proxy(handler, {
construct: function(target, parameters) {
var display= Object.create(target.prototype);
target.apply(display, parameters);
return display;
var display = new print('HELLO WORLD!');
Please follow and like us:
Content Protection by