Question: javascript function using window.prompt to take input from user and dynamic array Write a JS function that will take an array as an argument and
Write a JS function that will take an array as an argument and will calculate the avg of the numbers given in the array. If the array is empty the avg should be zero. The result should be printed in a div with an id of 'divAvg'. The array must be inserted by the user once the page loads using window.prompt. Example avg ([1,2,3])// prints 26 avg(D)// prints 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
