My attempt at solving Project Euler questions. Language: Javascript