const findMax = (nums)=>{
let max = nums[0]
for(let i=1;i<nums.length;i++){
if(max<nums[i]){
max = nums[i]
}
}
return max
}
const sequence = [5, 2, 9, 1, 7];
const max = findMax(sequence);
console.log(max); // 输出:9
const sequence1 = [10, 5, 3, 8, 6];
const max1 = findMax(sequence1);
console.log(max1); // 输出:10
const sequence2 = [4, 2, 7, 9, 11];
const max2 = findMax(sequence2);
console.log(max2); // 输出:11