4 ms·
> The default way promises are used is now async/await. `.then()` should not be introduced as anything more than 'you may find this in older codebases'. No, b
by throw_m239339 6y ago
> The default way promises are used is now async/await. `.then()` should not be introduced as anything more than 'you may find this in older codebases'.
No, because you might have to write explicit promises in the browser with async API that are callback based.
You need to understand how promises work to use async/await at first place anyway.
Just like it's better to understand how prototypal inheritance works in JS BEFORE even using a single class declaration.
- hutzlibu 6y ago"Just like it's better to understand how prototypal inheritance works in JS BEFORE even using a single class declaration. " About that, does JS class inheritance now work like classes in java for example? Or is it still just syntactic sugar for the prototype inheritance? By your wording, I assume the later?
- deleted 6y ago[deleted]
- wa1987 6y agoWell, it's complicated :-) https://stackoverflow.com/questions/36419713/are-es6-classes-just-syntactic-sugar-for-the-prototypal-pattern-in-javascript https://stackoverflow.com/questions/36419713/are-es6-classes...
- hutzlibu 6y agoWow. I was hoping, at some point things would improve a bit.
- wa1987 6y agoAgreed. I find myself using a pretty small subset of the language which definitely doesn't include the class keyword. Doubt I'll ever find it useful.
- hutzlibu 6y agoYeah, like many people, I ended up making my own inheritance routines. Then when class came out, I was half rejoicing, half regretting to put up the work. But well, no thanks. I rather keep using my own far from perfect way of things.
- ragnese 6y agoCorrect. It's still prototype based. Thus making the class keyword actually MORE confusing for people from other languages, IMO.
- nailer 6y agoYes because you can and should promisify old libraries.
- throw_m239339 6y agoNo because some async Web API are just a bit more complex than just 'promisify' this or that.
- nailer 6y agoWhich ones?