DEV Community

Discussion on: 8 JavaScript Tips & Tricks That No One Teaches 🚀

Collapse
 
ignaciojvig profile image
Info Comment hidden by post author - thread only visible in this permalink
João Victor Ignacio

Thanks for sharing Garvit! About your first topic, Functional Inheritance, I don't actually agree with what you've said. Since the idea is to hide the object within a function, it kinda works, BUT, that's totally different from the concept of 'private' as data encapsulation. You can still get the object and do whatever you want. All that you doing there is hiding an object inside another, and then retrieving it. Also, be careful when using 'var', especially when talking about concepts like hoisting and closures. Your variables were actually globally scoped and their memory will not be immediatly freed after using that function.

Collapse
 
garvitmotwani profile image
Garvit Motwani

Thanks For Sharing The Tip! Noted!

Some comments have been hidden by the post's author - find out more