4 ms·
Or my preferred (gross) version: void async function main() { // code }()
by james-mcelwain 7y ago
Or my preferred (gross) version:
void async function main() {
// code
}()
- elyobo 7y agoMine all tend to look like (async () => { // code })().catch(console.error)
- jraph 7y agoWow, I had completely forgotten the existence of void in JavaScript. Why is it needed here? To force an expression without using the parentheses? Edit: Yes, it seems so, and this usage with functions is explicitly documented there: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- ericlewis 7y agoYep. Exactly why. Seems silly since it doesn’t really care for types in the first place.
- deleted 7y ago[deleted]