MAx second and first Number
Anjali Gurjar

Anjali Gurjar @anjali_gurjar_dff81513867

About: I am Anjali Gurjar Work as Software Developer, I have total experience 4.5 .

Joined:
Dec 3, 2024

MAx second and first Number

Publish Date: Feb 28
0 0

const arr = [-1, -2, -3, 4, 5, 7, 8, 4];

let second =-Infinity
let max=-Infinity
let result = [];

for( let num of arr){
if(num>max){
second=max
max=num
}
else if(num>second && num<num){
second=num
}

}
console.log(second)
console.log(max)

Comments 0 total

    Add comment