constructor() vs extends
constructor() and extends are both JavaScript Class APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. constructor(): Creates class instances. Its syntax is constructor(params). extends: Inherits from another class. Its syntax is class Child extends Parent. Example of constructor(): class Foo { constructor(x) { this.x = x } }. Example of extends: class Dog extends Animal { }. Read the full references for constructor() and extends to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Class APIs worth comparing: class, super(), static, new.target. Both belong to the Class category in the JS Reference documentation, which covers 6 entries in total. Try both in the JavaScript playground to see the behavioral difference live.