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
Copy file name to clipboardExpand all lines: 1-js/09-classes/02-class-inheritance/article.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,7 @@ That label affects its behavior with `new`.
245
245
- When a regular function is executed with `new`, it creates an empty object and assigns it to `this`.
246
246
- But when a derived constructor runs, it doesn't do this. It expects the parent constructor to do this job.
247
247
248
-
So a derived constructor must call `super` in order to execute its parent (non-derived) constructor, otherwise the object for `this` won't be created. And we'll get an error.
248
+
So a derived constructor must call `super` in order to execute its parent (base) constructor, otherwise the object for `this` won't be created. And we'll get an error.
249
249
250
250
For the `Rabbit` constructor to work, it needs to call `super()` before using `this`, like here:
0 commit comments