Expanding code I've been working on for a supplement tracker but my current function is not returning accurate count of numbers greater than the average 'mean' nor the count of integers below the mean average. I've also commented out two questions within the code because I don't quite understand why the array is set to index[0]. I've learned much from the comments and searching for answers here. So thankful this site exists! Looking to learn a bit more hopefully with this question.
function suppArray() {
var nums = new Array(); //create array 
var sum = 0; //variable to hold sum of integers in array
var avg = 0; //variable to hold the average
var i; 
var count = 0;
var count2 = 0;
var contents = ''; //variable to hold contents for output 
    var dataPrompt = prompt("How many numbers do you want to enter?", "");
    dataPrompt = parseInt(dataPrompt);
    for(i = 0; i <= dataPrompt - 1; i++) { //loop to fill the array with numbers 
        nums[i] = prompt("Enter a number","");
        nums[i] = parseInt(nums[i]);
        contents += nums[i] + " "; //variable that will be called to display contents
        sum = sum + nums[i];
    }
        avg = sum / nums.length; 
    for(i = 0; i < nums.length; i++) { //loop to find the largest number
        var biggest = nums[0]; //why does this have to be index 0 and not 'i' ?
        if(nums[i] > biggest) 
        biggest = nums[i]; //largest integer in array
    }
    for(i = 0; i < nums.length; i++) { //loop to find smallest integer
        var smallest = nums[0]; //why does this have to be the index 0 and not 'i' ??
        if(nums[i] < smallest) 
        smallest = nums[i]; //smallest integer in array
    }       
    for(count = 0; count < nums.length; count++) { //count of numbers higher than average
        if(nums[i] > avg) 
        count = nums[i];
    }   
    for(count2 = 0; count2 < nums.length; count2++) { //count of numbers lower than average
        if(nums[i] < avg)
        count2 = nums[i];
    }
}
 
     
     
    