Implement getTotal function in helper.js
It should return the sum of all elements in the array.
Array will only contain numbers.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
helper.js
export const getTotal = (arr) => {
return 0;
}
solution.js
/**
* Implement getTotal function in helper.js
*
* It should return return the sum of all elements in the array
*
* Array will only contain numbers
* */
import { getTotal } from './helper.js';
const revenue = [10, 10, 20, 55, 1, 5, 12, 15];
console.log(`For the array ${revenue}, total is ${getTotal(revenue)}`);