function find_max(nums) {
let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
for (let num of nums) {
if (num > max_num) {
// (Fill in the missing line here)
}
}
return max_num;
}
help me fill the missing line
function find_max(nums) {
let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
for (let num of nums) {
if (num > max_num) {
// (Fill in the missing line here)
}
}
return max_num;
}
help me fill the missing line
Know the answer? Post it. Somebody with the same question will find it here.

Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Bohdan StupakRank #479 · 5.2K reputationPosted Oct 17, 2021, 10:40 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Oct 17, 2021, 1:17 PM EDT