let arr=[5,18,26,30,40,6];
function largest(arr)
{
let i;
let max = arr[0];
for (i = 1; i < arr.length; i++)
{
if (arr[i] > max)
max = arr[i];
}
return max;
}
console.log('Max='+largest(arr));