As developers, we’re expected to know a lot of random things. Sure, you can learn data structures and algorithms from a CS class, and you can learn frameworks from online tutorials or a bootcamp, but what about the other things? How to be more effective on the command line? How to increase productivity on your […]
Archives for June 2023
Flatten an array in Javascript
Flattening an array means making it one-dimensional. The easiest way to flatten an array is via Array.prototype.flat. For many years, doing this in javascript required the use of concat, spread, or reduce. Not anymore. Flatten with Array.prototype.flat This method does exactly what you’d expect: By default, flat only flattens one level deep: But flat accepts […]
Python try except
Try and except are the building blocks of exception handling in Python. You’ll also sometimes see finally and else. Here’s the summary: Try and Except A simple try-except block looks like this: You’ll usually see try and except by themselves; finally is used less often, and else even less. Here’s a (slightly) more realistic example: […]