JavaScript Snippets

Code Samples

JavaScript Code Snippets Banner

Cut The Sticks

Given N sticks, reduce the length of each by the length of the smallest stick. Print the number of sticks that are left before each cut operation.

Array Rotation

John Watson performs an operation called a 'right circular rotation' on an array of integers. Find the element at index 'm' in the rotated array.


Compare two jumping kangaroos to see if they are ever at the same position.

One Minute Timer

Simple countdown with a combined start/reset button.

Arc Animation

Animated ring that goes with a one-minute countdown timer using HTML5 canvas.