0

What will be the output(javascript) plz explain

len is 6 arr is [40,100,1,5,25,10] While(len--) { If (arr[len]>max) { max = arr[len]; } } return max; }

16th Oct 2017, 3:07 PM
👑 Code Lord 👑
👑 Code Lord 👑 - avatar
1 Answer
+ 1
syntax error. after removing one }, I would expect the output: 10 25 25 25 100 100 you iterate reversed over the array, store the current value as max if it's greater than the old max value and output the new actual max
16th Oct 2017, 3:30 PM
Carl Fies
Carl Fies - avatar