Skip to content
Latest: Publish JavaScript Packages to NPM Like a Pro!

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