Euler problems 6 - 10 Javascript