Find the maximum in the array

find the maximum in the array
var arr=[4,6,3,7,4,9,1]

1 Like

var arr=[4,6,3,7,4,9,1]
var max=arr[0];
for(var i=0;i<arr.length;i++)
{
if(max<arr[i])
{
max=arr[i];
}
}
console.log(max)

2 Likes

Very good and correct :100: . Keep learning :blush: