A javascript exercise