Solved the first 3 problems of Project Euler using Javascript