Scratch repository for testing automations.
Add mean, median, and standard deviation functions to math.js #17
Resolved by Add mean, median, and standard deviation functions to math.js #20, merged by syntaqx
Implement three new statistics functions in math.js:
mean(numbers): returns the average of an array of numbers. ThrowsTypeErrorif array is empty.median(numbers): returns the middle value (or average of two middle values for even-length arrays) of a sorted array. ThrowsTypeErrorif array is empty.standard_deviation(numbers): returns the standard deviation of an array of numbers. ThrowsTypeErrorif array is empty.
Add all three to the module.exports object alongside add, multiply, and power.
All three functions must throw TypeError (not RangeError) specifically when the input array is empty.
Definition of done
- math.js exports mean, median, standard_deviation
- Each function throws TypeError when called with an empty array
Pull requests
1 for this issue