Write a Javascript function that is passed in an array of test scores. For every test score under 50, print “needs work”. Print the highest test score below the total average of all the test scores. Print how many even test scores where above the total average of all test scores.
NOTE: The indents get messed up in html. Use your bracket matching skills like you use in read code. Remember the if does not need brackets if just one statement either done or skipped.
function findAverage(nums)
{
sum=count=high=avg=0;
for (i=0;i<nums.length;i++)
{
if (nums[i]<50)
{
document.write(“needs work” +<br>”);
}
sum = sum + nums[i];
}