Content pfp
Content
@
0 reply
0 recast
0 reaction

jxom  pfp
jxom
@jxom
A couple of JavaScript tricks using promise syntax: 1. We can transform a try/catch block into a one-liner (also means `result` return type is inferred properly), 2. We can transform a `fetch` → `.json` chain into a one-liner `.then` and `.catch` are still cool (sometimes)!
7 replies
0 recast
16 reactions

YuriNondual pfp
YuriNondual
@yurinondual
well the second one, unless you actually need to check response status before doing .json()? 🤔
0 reply
0 recast
0 reaction