I have multiple arrays of size 262144, and I am trying to use the following code to set all the values of each array to between 0 and 1, inclusive. To be clear, each array will be normalized differently because each has different values.

```
var i;
var max = Number.MIN_VALUE;
var min = Number.MAX_VALUE;
for (i = 0; i < array.length; i++) {
if(array[i]>max) {
max = array[i];
}
}
for (i = 0; i < array.length; i++){
if(array[i]<min) {
min = array[i];
}
}
for (i = 0; i < array.length; i++) {
var norm = (array[i]-min)/(max-min);
array[i] = norm;
}
```

However, I know that it's not doing this correctly because when I do the following code, the numbers logged to the console are often above 1.

```
max = Number.MIN_VALUE;
min = Number.MAX_VALUE;
for (i = 0; i < array.length; i++) {
if(array[i]>max) {
max = array[i];
}
}
for (i = 0; i < array.length; i++) {
if(array[i]<min) {
min = array[i];
}
}
console.log(max);
console.log(min);
```

What am I doing wrong? Thank you!