Array Competency Practice

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)


      for (i=0;i<nums.length;i++)
if (nums[i]<50)
document.write(“needs work” +<br>”);

sum = sum + nums[i];

    avg = sum/nums.length;

if (nums[i] < avg )
if (nums[i]>high)
high = nums[i];

          if (nums[i] > avg)
If (nums[i] % 2 == 0)
count = count+1;


document.write(“biggest less than avg is “+high+”<br>”);
document.write(“number evens over avg is “+count+”<br>”);