JS Quirk: Hiding Methods with Properties

I recently stumbled on a neat JavaScript quirk: an object can actually hide a method from its prototype just by having a property with the same name. Even then, the method itself isn’t lost! You can still call it by borrowing it from Object.prototype and explicitly setting this. It’s a small reminder of how objects in JS separate data from behavior, and how flexible prototypes really are. #JavaScript #WebDev #CodingTips #DeveloperLife #JSQuirks

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories