README.md
automation lab
Functions
All functions are exported from math.js.
const { add, multiply, power, mean, median, standard_deviation } = require("./math");js
add(a, b): returns the sum ofaandb.add(2, 3); // 5jsmultiply(a, b): returns the product ofaandb.multiply(4, 5); // 20jspower(base, exponent): returnsbaseraised to a whole-numberexponent; throws aRangeErrorifexponentis negative.power(2, 3); // 8jsmean(numbers): returns the average of an array of numbers; throws aTypeErrorif the array is empty.mean([1, 2, 3, 4]); // 2.5jsmedian(numbers): returns the middle value (the average of the two middle values when the length is even); throws aTypeErrorif the array is empty.median([3, 1, 2]); // 2 median([1, 2, 3, 4]); // 2.5jsstandard_deviation(numbers): returns the population standard deviation; throws aTypeErrorif the array is empty.standard_deviation([2, 4, 4, 4, 5, 5, 7, 9]); // 2js