JavaScript version of pullOfThePlanets