hackbright exercise in basic javascript — project euler problem 1