Saikiran N G’s Post

📝 JavaScript Interview Coding Task Question – Day 73 Look at this code snippet 👇 ✅ Answer & Explanation: Parent constructor Child constructor Hello from Parent Hello from Child 1️⃣ The super keyword in classes is used to call methods on the parent class. 2️⃣ In the Child class, the constructor calls super() → this triggers the Parent constructor first before accessing this. 3️⃣ When child.sayHello() is called, it uses the overridden method in Child, but inside it, super.sayHello() invokes the parent’s version. 4️⃣ The output shows how inheritance chains both constructors and methods, combining parent and child logic. ✨ Tip: 👉 Always call super() before using this in a subclass constructor. 👉 super.method() helps reuse parent logic without rewriting it. #100DaysOfCode #JavaScript #Frontend #WebDevelopment #CodingInterview #JSClasses #Inheritance #DailyCoding #LearnInPublic #kirantechnophile

  • text

To view or add a comment, sign in

Explore content categories