HI!

I was reading some information to find the MAX and MIN number from an array, but I saw this code, and I have some doubts…I would appreciate any help provided.

```
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Array Sort</h2>
<p>The highest number is <span id="demo"></span>.</p>
<script>
var points = [40, 100, 1, 5, 25, 10];
document.getElementById("demo").innerHTML = myArrayMax(points);
function myArrayMax(arr) {
var len = arr.length;
var max = -Infinity;
while (len--) {
if (arr[len] > max) {
max = arr[len];
}
}
return max;
}
</script>
</body>
</html>
```

why does the function say function myArrayMax(arr), I know arr is the parameter, but then, the parameter is not given but the function works perfectly in the example. Shouldn’t it be function myArrayMax(points)?

After that, why does it say that var max=-infinity?

Why is it that if the number is > than -infinity it will be the max?

Thank you for your help.