@anithasandrine/sandrine-addition-elememts
v1.0.0
Published
My package
Downloads
4
Readme
sum-array-elements
A simple utility function to calculate the sum of elements in an array, including both numbers and strings representing numbers.
Installation
npm install sum-array-elements
Usage
javascript code
const elements = [1, 2, "3", "4", 5];
console.log(sumElements(elements));
// Output: 15
description
sumElements(arr) Calculates the sum of elements in the provided array.
arr: An array of numbers or strings representing numbers. Returns the sum of all elements in the array.
Example
javascript
const elements = [1, 2, "3", "4", 5];
console.log(sumElements(elements)); // Output: 15
License
This project is licensed under the MIT License - see the LICENSE file for details.