CalculatorsLesson 178Free preview
Sum a List of Numbers
This lesson is part of Web Developer Tools · All levels
Summary
Sum a List of Numbers sums the set of numbers separated by commas, spaces, or new lines. The tool also typically displays the amount of data, the mean, the minimum, and the maximum values. When processing input, ignore empty entries and validate numbers so that the result is not NaN.
Key points
- Common divisors: commas, spaces, semicolons, and new lines
- Convert each entry to a number before adding it up
- Ignore the empty string so it doesn't count as zero.
- Average = the sum divided by the number of valid data
- Be careful with decimal dividers of commas versus thousands
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.