Write a JS function that will take an array as an argument and will calculate the sum of the numbers given in the array. If the array is empty the sum should be zero. The result should be printed in a div with an id of ‘divSum’. The array must be inserted by the user once the page loads using window.prompt. Example sum([1,2,3]) //prints 6 sum([]) //prints 0
Asked
Active
Viewed 20 times
-3
-
This is not a code writing service, read [ask] – Alon Eitan May 12 '22 at 16:40