Javascript exercise from teaching-materials