Skip to content
Intern–Middle165 views

Implementation of a function that calculates the sum of array elements

Task condition

You need to write a function that calculates the total sum of all elements in the given array, using any method you know.

const arr = [1, 2, 3, 4, 5]

The function should take an array as an argument and return a number – the sum of its elements.

Frontend tasks in the code trainer