Javascript challenge for job application