You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is well-known but may also be considered an antipattern, especially because it cannot be encapsulated, and instead the constructor name must be updated in three places, and the argument list in two, if either is changed, all because Function#apply cannot perform a constructor call:
functionConstructor(arg,arg2){if(!(thisinstanceofConstructor)){returnnewConstructor(arg,arg2);}// rest of constructor code}
The text was updated successfully, but these errors were encountered:
This is well-known but may also be considered an antipattern, especially because it cannot be encapsulated, and instead the constructor name must be updated in three places, and the argument list in two, if either is changed, all because
Function#apply
cannot perform a constructor call:The text was updated successfully, but these errors were encountered: