I am a beginner in JavaScript and wanted to ask the following question: I was trying to use a main function to prompt the user to input 4 numbers, then pass those through the display function. The display function then takes those and passes them through max, min, avg and prints them on the screen. Is there a reason why my code doesn't work? (have been looking online for days now and no matter what I do I can't seem to make it work)

Here is the code: [JSFiddle link](https://jsfiddle.net/s8je6kxu/4/) (Has comments)

```
<!doctype html>
<!--
The main() function first reads 4 numbers from the user with proper prompt; then it calls the display() function with four numbers

Trying to find the max, avg, and min using multiple functions with 4 parameters each    
-->

```

.

```
<html>
<body onload="main()">

<p id="max"></p>
<p id="avg"></p>
<p id="min"></p>

<!-- JS begins here-->

<script>
function main()
{
alert("Please enter 4 numbers so that I may give you the maximum, minimum, and the average of the 4 numbers.");

 var n1 = +prompt("Please enter the first number: ");
 var n2 = +prompt("Please enter the Second number: ");
 var n3 = +prompt("Please enter the Third number: ");
 var n4 = +prompt("Please enter the Fourth number: ");
}

function display(n1, n2, n3, n4)    
{
document.getElementById("max").innerHTML = "The maximum is: " + max1();
document.getElementById("avg").innerHTML = "The average is: " + avg1();
document.getElementById("min").innerHTML = "the minimum us: " + min1();
    alert(max1());
}

function max1(n1, n2, n3, n4)
{
 if(n1 > n2 && n1 > n3 && n1 > n4)
    {
        return n1;
    }
 else if(n2 > n1 && n2 > n3 && n2 > n4)
     {
         return n2;
     }
 else if(n3 > n2 && n3 > n1 && n3 > n4)
     {
         return n3;
     }
 else if(n4 > n2 && n4 > n3 && n4 > n1)
     {
         return n4;
     }
}

function avg1(n1, n2, n3, n4)
{
 var total = 4;
 avg = (n1 + n2 + n3 + n4) / 4;
 return avg;
}

function min1(n1, n2, n3, n4)
{
 if(n1 < n2 && n1 < n3 && n1 < n4)
    {
        return = n1;
    }
 else if(n2 < n1 && n2 < n3 && n2 < n4)
     {
         return = n2;
     }
 else if(n3 < n2 && n3 < n1 && n3 < n4)
     {
         return = n3;
     }
 else if(n4 < n2 && n4 < n3 && n4 < n1)
     {
         return = n4;
     }
}

//max1();
//min1();
//avg1();

</script>
</body>
</html>

```