Solving For The Max Value In An Array
Ayo Alfonso
228

Not a very easy article to follow. I don’t think someone who needed this article would be a good hire. First of all, the idea to use array[0] as the initial max is not actually used in the code displayed. If that idea were implemented, the rest of the article would have been moot.

var maxVal = arr[0];

for (var i = 0; i < arr.length; i++) {

if (maxVal < arr[i]) {

maxValue = arr[i];

}

}

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.