function find_max(nums) { 2 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;

function find_max(nums) {
2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
3 for (let num of nums) {
4 if (num > max_num) {
5 // (Fill in the missing line here)
6 }
7 }
8 return max_num;
9 }

4
5
Awgiedawgie 440220 points

                                    To1 function find_max(nums) {
2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
3 for (let num of nums) {
4 if (num > max_num) {
5 // (Fill in the missing line here)
6 }
7 }
8 return max_num;
9 }

4 (4 Votes)
0
3.7
10
Phoenix Logan 186120 points

                                    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;
}

3.7 (10 Votes)
0
3.88
8
Krish 100200 points

                                    1 function find_max(nums) {
2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
3 for (let num of nums) {
4 if (num > max_num) {
5 // (Fill in the missing line here)
6 }
7 }
8 return max_num;
9 }

3.88 (8 Votes)
0
3
1
Awgiedawgie 440220 points

                                    def find_max(nums):
max_num = float("-inf") # smaller than all other numbers
for num in nums:
if num > max_num:
  # (Fill in the missing line here)
return max_num

3 (1 Votes)
0
4.5
2
Awgiedawgie 440220 points

                                    num = max_nam

4.5 (2 Votes)
0
5
1
Awgiedawgie 440220 points

                                    1 function find_max(nums) {
2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers
3 for (let num of nums) {
4 if (num > max_num) {
5 // (Fill in the missing line here)
6 }
7 }
8 return max_num;
9 }

5 (1 Votes)
0
0
0
Awgiedawgie 440220 points

                                    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;
}

0
0
5
3
Krish 100200 points

                                    function find_max(nums){
let max_num=Number.NEGATIVE_INFINITY;
for(let num of nums) {
if(num>max_num){
max_num=num
}
}
return max_num;
}

5 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source