catch to set a default value instead of a
// Instead of wrapping this block in a try/catch... const result = await new Promise( (resolve, reject) => reject("Because Stone Cold said so") ) // ...use catch to set the default value (100) .catch(() => 100);
As a trick I really like what’s this brings; as far as readability and maintenance, if you don’t know the trick, you might get confused. What do you think?
Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices. While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo…
CSS has become more and more powerful over the past few years and CSS transforms are a prime example. CSS transforms allow for sophisticated, powerful transformations of HTML elements. One or more transformations can be applied to a given element and transforms can even be animated…