Formatted code to have all variable declarations at the top of the page. added an alert to show the results.