4 ms·
Fun with Promises in JavaScript
- ryandvm 11y agoSo, that's 4 function declarations to write a simple wait timer. How is that Javascript saves us from the verbosity of Java again?
- davelnewton 11y agoI know you realize it's an example and as an example it probably isn't the best. I also have to assume you know that promisified code is almost always a better approach than nesting, particularly deep nesting. So I'm missing your point.
- ryandvm 11y agoHeh. My point wasn't that promises are worse than callback hell - they aren't. I was just making an irrelevant grumpy-old-man gripe about how much boilerplate JavaScript has for a language whose proponents spent so much energy decrying Java for boilerplate. Don't worry, I fully appreciate the down-votes I get when I do that shit.
- davelnewton 11y agoI don't generally see people switching to JS for less boilerplate than Java, but for other reasons. That said, there's a lot less boilerplate than Java, even with this. Plus promisification is usually a one-liner once you're using a module or define the function. I do grumpy-old-man stuff all the time too, although I'm getting better ;)