Javascript implementation of the L-diggity.