- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is super() function in JavaScript?
Use the super() function to call the constructor of the parent class and access functions on an object's parent class.
Example
You can try to run the following code to implement super()
<!DOCTYPE html> <html> <body> <script> class Department { constructor() {} static msg() { return 'Hello'; } } class Employee extends Department { constructor() {} static displayMsg() { return super.msg() + ' World!'; } } document.write(Employee.displayMsg()); </script> </body> </html>
- Related Articles
- Super keyword in JavaScript?
- Super Ugly Numbers JavaScript
- What is "function*" in JavaScript?
- What is function overloading in JavaScript?
- What is function chaining in JavaScript?
- What is function() constructor in JavaScript?
- What is a function literal in JavaScript?
- What is an anonymous function in JavaScript?
- What is the (function() { } )() construct in JavaScript?
- What is an Arrow Function in JavaScript?
- What is the currying function in JavaScript?
- What is the super class of every class in Java?
- What is the super() construct of a constructor in Java?
- What is a fat arrow function in JavaScript?
- What is the difference between super and this, keywords in Java?

Advertisements