new.target

using new.target inside constructors

After the introduction of new.target for classes in Chapter 4, you will now understand it more deeply by using the same language construct for functions.

You can retrieve the constructor function of an object inside the constructor by using new.target.

Get hands-on with 1400+ tech skills courses.