JavaScript challenge for Udacity front-end nanodegree