Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 422 Bytes

arraySum.md

File metadata and controls

17 lines (11 loc) · 422 Bytes

Back to reference

arraySum(arr)

Calculates the sum of all elements in an array of numbers arr. Doesn't work if any element in the array is not castable as a Number (e.g. "2" is possible, "Hello" is not).

Example:

let randomNumbers = [1, 3.3, 2, 7, -2];
let sum = gmynd.arraySum(randomNumbers);

// sum: 11.3

Credits to ChaosPandion