3 ms·
What’s wrong with top-level functions (as opposed to methods)? Is there a meaningful difference between foo(bar) and bar.foo()?
by xigoi 2y ago
What’s wrong with top-level functions (as opposed to methods)? Is there a meaningful difference between foo(bar) and bar.foo()?
- mike_hearn 2y agoSame reasons JS has modules that don't export everything, and for the same reason that React reinvented OOP under a different syntax with function components. Encapsulation, API design, runtimes and IDEs all work a lot better if the tools are aware of the link between the data and the code that's manipulating it.