IHU Challenge in Javascript