This is a challenge to come up with the most elegant JavaScript, Ruby or other solution to a relatively trivial …