Becoming a JavaScript Ninja (the lesson)
While writing the about the book Secrets of the JavaScript Ninja, I came to a realization. OOP languages help in understanding JavaScript initially, but are damaging in the long term.
Because the concepts from Java, C#, etc. are close to the concepts in JavaScript, they give a developer a 'leg up' when starting to understand the language. However, relying on the understanding that comes from other languages prevents a developer from fully grasping the power of JavaScript. It is, after all, as much a functional language as it is object based. For example:
- Methods are somewhat like functions
- Scopes are somewhat like closures
- Classes are somewhat like prototypes
It's just like learning a spoken language; If you want to speak fluently, you need to stop translating from your native tongue and learn to think in a new language.