Salesforce JavaScript Developer Practice Exam 2026 – Comprehensive Test Prep

Question: 1 / 400

In a class that extends another class, what method is used to call the parent class's constructor?

call()

super()

In JavaScript, when working with classes that extend other classes, the correct way to call the parent class's constructor is by using the `super()` method. This allows the child class to access and initialize properties of the parent class before executing its own constructor.

When you define a class that extends another class, you need to call `super()` within your constructor before you can use `this`. The `super()` function will invoke the constructor of the parent class, ensuring that any inherited properties and methods are properly set up.

For example, within the child class, if you don't call `super()`, you would encounter a reference error when trying to access `this`, as it hasn't been defined yet. This mechanism allows for a clear inheritance structure and ensures that the child class can appropriately extend the functionality of the parent class.

The options that do not relate to this specific task like `call()`, `init()`, and `constructor()` do not serve this purpose in the context of class inheritance. `call()` is used for function invocation, `init()` is not a standard method in JavaScript classes, and while `constructor()` is indeed the name of the constructor method, it does not specifically call the parent constructor—the `super()`

Get further explanation with Examzify DeepDiveBeta

init()

constructor()

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy