try / catch / finally / throw

Javascript error handling can be helpful to help debug code. It’s a great tool to pickup and be consistent with. This may not be the most fun post, but arguably one of the most important to know.

I’m going to walk through 2 separate examples for how to use JS errors.


First, lets talk about the syntax. I like to think of the set up like an if / else if / else statement.

try {

// Block of code to test
} catch(e) {

// Block of code to handle errors
// If there was an error they are put into an object
// In the case above: 'e' is an object that has multiple
// properties we can pull values off and use. …

I spend the majority of my time in OSX Terminal and my Atom text editor. However, when I was recently given the task to put together a webpage hosting a gallery of images I needed a quick way to re-size my folder of multiple hi-res photos. Normally I would have access to an external API that includes URLs of different image sizes. In this case I had to figure out how to automate and convert a large numbers of files all at once.

Photoshop’s actions saved the day. Below is a quick tutorial how to take the editing you do on one image and apply the same edits to an entire folder of images. …

I’ve spent some time trying to figure out some new styling in CSS that isn’t always standard in the ‘book’ or tutorials.


Before the fun… An important task I wanted to solve is when we have a parent element whose children extend outside of the its div/box/region. What does this mean? We’re basically forcing an element to self-clear its floating children.

/* Parent CSS Tag */
.parent:after {
content: "";
display: table;
clear: both;
<!-- Here we’ll clear any floats in the HTML -->
<div class=“parent">
<div class=“floated-child1"></div>
<div class="floated-child2"></div>
<div class="floated-child3"></div>


This had me plagued (for a hot 5 minutes). I was all excited to style my own input borders and be all crafty however every time I focused on the element I’d notice a little blue border around it. The solution is in the outline property. …

Rob Hitt

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store