Monday, February 5, 2018

var nums = [6, 88, 0, -1, 34];

var text = "";
var largest=-999;
for (var i=0; i < nums.length; i++) {
    
    if(nums[i]>largest)
     largest=nums[i]
}

alert(largest + "is the largest number in the array");

No comments: