historical_life_expectancy.js near solution, bug in averageAges function