3 ms·
I agree but second one could just be `() => Promise.resolve()`
by kabes 4y ago
I agree but second one could just be `() => Promise.resolve()`
- adamauckland 4y agoIt could, but depending on how you use it, you're changing scoping.
- kabes 4y agoTrue. But these days it's rare to see a scope other than what you'd expect from the short hand version. Old school JS with plain prototypes and flexible 'this' scope is very powerful, but is too hard to understand and thus rare these days.
- eurasiantiger 4y agoThat’s one of the neat things about JS: even outside the prototypal inheritance chain, classes can be (partially) composed of generalized, reusable functions, a bit like traits. Just import a function and bind it in the constructor (call).