Hello Dev Community! 👋
It is officially Day 25 of my journey to master the MERN stack! After the excitement of building a Tic-Tac-Toe game yesterday, today I returned to the Apna College curriculum with Shradha Didi to tackle a heavy engineering concept: Object-Oriented Programming (OOP) Fundamentals in JavaScript.
Specifically, today was all about looking under the hood to see how JavaScript objects share properties using Prototypes.
🧠Key Learnings From JS Lecture 9 (Part 1)
JavaScript objects are powerful, but understanding how they inherit features changes how you structure programs. Here is what I cracked today:
1. The Power of the this Keyword
I learned that inside an object method, this refers to that specific object itself. It allows functions inside an object to access its own properties dynamically:
javascript
const student = {
name: "Ali Hamza",
marks: 95,
printMarks: function() {
console.log("Marks =", this.marks); // 'this' means student
}
};
Top comments (0)