๐๐ฎ๐ ๐ฎ๐ฑ ๐ผ๐ณ ๐ ๐๐ฅ๐ก ๐ฆ๐๐ฎ๐ฐ๐ธ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด
I spent today studying Object-Oriented Programming in JavaScript.
I focused on how objects share properties through Prototypes. This knowledge helps you structure better programs.
One major concept I learned is the this keyword.
In an object method, this refers to the object itself. It lets functions access properties inside that same object.
Example:
const student = { name: "Ali Hamza", marks: 95, printMarks: function() { console.log("Marks =", this.marks); } };
In this example, this points to the student object. It pulls the marks value directly from the object.
Understanding this makes your code more efficient.
Source: https://dev.to/ali_hamza_589ec7b3eb6688d/day-25-of-learning-mern-stack-2npf