Skip to content
9branchesTags

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 of a and b.
    add(2, 3); // 5
    js
  • multiply(a, b): returns the product of a and b.
    multiply(4, 5); // 20
    js
  • power(base, exponent): returns base raised to a whole-number exponent; throws a RangeError if exponent is negative.
    power(2, 3); // 8
    js
  • mean(numbers): returns the average of an array of numbers; throws a TypeError if the array is empty.
    mean([1, 2, 3, 4]); // 2.5
    js
  • median(numbers): returns the middle value (the average of the two middle values when the length is even); throws a TypeError if the array is empty.
    median([3, 1, 2]); // 2
    median([1, 2, 3, 4]); // 2.5
    js
  • standard_deviation(numbers): returns the population standard deviation; throws a TypeError if the array is empty.
    standard_deviation([2, 4, 4, 4, 5, 5, 7, 9]); // 2
    js

Agent runs here have a filtered network: package registries and g1t only.