- 📘 Comes with built-in TypeScript definitions
- 🚀 Lightweight and fast
- 👴 Compliant with ECMAScript 3
-
function average(array: number[]): number;
Finds the average of an array of numbers.Name Type Description Optional? array
number[]
The array whose average is to be calculated. No
import average = require('@santi100/average-lib'); // TypeScript
import average from '@santi100/average-lib'; // ESM
const average = require('@santi100/average-lib'); // CJS
// Example usage of the average function
const numbers: number[] = [1, 2, 3, 4, 5];
const avg: number = average(numbers);
console.log(`The average of ${numbers} is: ${avg}`);