A series of spheres, nested inside each other

Elements often need to be sorted: think of an array of game scores that need to be arranged from high to low to determine player rank. Unfortunately, the standard JavaScript sort() method has some surprising limitations: it works well with common English words, but breaks down when faced with numbers, accented characters, or words in uppercase.

Move your mouse or touch to re-orient pointer image

Using CSS transforms, transitions and animation, we can rotate any element on the page, but CSS won’t allow us to do that dynamically, in response to user input. To make that happen, we need JavaScript, combined with the lessons I’ve shown to this point regarding CSS rotation.