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 }

// Using this will gives lowest possible starting point.
// It is useful when initiating a variable that will be compared against negative numbers.
Number.NEGATIVE_INFINITY // Or,
-INFINITY

// The opposite is INFINITY. The largest possible starting point.
Number.POSITIVE_INFINITE // Or,
INFINITY

5
5
Phoenix Logan 186120 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)
1

num=max_num

4
7
Awgiedawgie 440215 points

                                    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 (6 Votes)
0
4.33
6
Awgiedawgie 440215 points

                                    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.33 (6 Votes)
0
0
0

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

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
js to define negative infinity why use negative infinity in javascript Number.NegativeInfinity javascript how to assign negative infinity in javascript 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 &amp;gt; max_num) { 5 // (Fill in the missing line here) 6 } 7 } 8 return max_num; 9 } how to take positive infinity in js NEGATIVE_INFINITY js example of negative infinty in js infinite negative js value js Number.NEGATIVE_INFINITY javascript negative Infinity keyword negative inifinity in javascript how to get negative infinity in javascript infinity negative infinity javascript negative_infinity in javascript negative infinity in javascriopt function find_max(nums) { 2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers for (let num of nums) { if (num &amp;gt; max_num) { // (Fill in the missing line here) } } return max_num; js positive infinity javascript NEGATIVE_INFINITY javascript positive infinity negative infinity javascript math negative infinity javsacript javascript positive and negative infinity What is negative infinity in Java script? positive infinity in javascript javascript number.negative_infinity javascript smallest negative number javascript infinite javascript negative number 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 &gt; max_num) { 5 // (Fill in the missing line here) 6 } 7 } 8 return max_num; 9 } javascript infinity adding the values in plus and minius to infinity in javascript how to store minus infinty in js javascript infinity and negative infinity what is negative infinity in javascript set negative max value javascript let max_num = Number.NEGATIVE_INFINITY; number.negative_infinity javascript javascript negative random number random negative number javascript minus infinity javascript nodejs Infinity egative negitive infinity JS negative infinity float negative infinity javascript positive infinity javascript negative_infinity javascript Number.NEGATIVE_INFINITY; javascript number.negative_infinity in javascript negative infinity javacript js minus infinity how to give minus infinite in js javascript infinity minus negative infinity in javascript function find_max(nums) { 2 let max_num = Number.NEGATIVE_INFINITY; // smaller than all other numbers for (let num of nums) { if (num &gt; 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 &gt; max_num) { 5 // (Fill in the missing line here) 6 } 7 } 8 return max_num; 9 } javascript minus infinity positive negative infinity js negative infinity js js initialize to negative infity js negative infinity negative infinity javascript javascript negative infinity
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