Coded problem 4 into the js file.