Skip to content
Node.js Sounds Complicated? This Article Makes It Click

Edit It: Use new.target to confirm if the new operator invoked the constructor

Home>new Operator in JavaScript>Edit It: Use new.target to confirm if the new operator invoked the constructor

Edit It: Use new.target to confirm if the new operator invoked the constructor

This code shows how to use new.target to confirm if the new operator invoked a constructor.

See it on StackBlitz