Functions with closures are as powerful as OOP and can be used analogously.
Also, singletons aren't portable.
206 karma · joined November 23, 2015
Also, singletons aren't portable.
Javascript was actually fairly consistent, despite having some pitfalls, until they decided to add classes and lexical scoping (e.g. you can't actually bind a context to a fat-arrow function, while you can for the older syntax), so now there's like 5 different ways to do everything and some have more pitfalls than others. At least I know how I can use the updates to make my own code cleaner, and new coders can just ignore that prototypal inheritance ever existed and the unique design patterns that came with it.