JavaScript Challenge #1: Review

Written By Christopher Pitt, on Wednesday, August 8th 2012, 2:50am

The first JavaScript challenge was a huge success, with many excellent entries. While there are many excellent entries, we found the following few taught us interesting and helpful lessons…

Lucas Corbeaux - http://jsfiddle.net/G5RuR/

Code reuse is a big issue when it comes to large-scale systems written in JavaScript. Lucas’ example shows us a method of wrapping processing/private code within a closure to provide a clean API and protected internal code.

Mickele Moriconi - http://jsfiddle.net/THrr6/1/

While not technically JavaScript, Mickele’s example showcases a neat CoffeeScript/Canvas approach to drawing the spiral, complete with text rendering code. If you have never seen or used CoffeeScript Mickele’s example may prove useful in learning some of the basic syntax differences.

Klaas Moerman - http://jsfiddle.net/BNs9z/

Using some clever maths, Klaas’ example shows how the spiral pattern can be generated using a tiny amount of code. While this doesn’t teach us anything specific to JavaScript, the algorithm is still pretty neat!

Cristian Carlesso - http://jsfiddle.net/kentaromiura/KtPw5/2/

Nyan nyan nyan, nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan nyan. Nyan nyan; nyan nyan nyan nyan - “Nyan nyan nyan nyan nyan nyan nyan.”. Nyan nyan nyan nyan nyan nyan nyan.

Tim Wienk - http://jsfiddle.net/timwienk/RQZ7H/

With the advent of Node.JS et al. the JavaScript world has been moving in the direction of Asynchronous Module Definition (AMD) as a means of defining and controlling modules and module dependencies. Tim’s example shows us some of the steps to take in order to create AMD compatible modules of code.

Arian Stolwijk - https://tinker.io/024e3/4

If nothing else, this example’s code is beautifully formatted. It also showcases some neat CSS3-based animation.

Pete - http://jsfiddle.net/tq6Zf/

This guy earns serious points for posting a jQuery solution on a MooTools blog. :)

The purpose of Challenge #1 was to introduce the challenges and exercise your logical brain; using as little “framework” code as possible. We would like to thank everyone that participated - it was fun to see so much conversation and collaboration around a fun JavaScript challenge.

Be sure to check out the Challenges category of blog posts for new challenges every week!

3 Responses to “JavaScript Challenge #1: Review”

  1. Alxandr says:

    Why not ease up a little on the nyan-cat?

    http://jsfiddle.net/KtPw5/4/

  2. Christopher Pitt says:

    Alxandr: the cat gets no peace. :)

  3. Mickele Moriconi says:

    Klaas’s was pretty neat, indeed!