Coded problem 3 into the .js file.