javascript infinite loop error in my array -


This is the code I am writing ATM:

  var array = [3, 6, 2, 56, 32, 5, 89, 32]; Largest = 0; For (var i = 0; i & lt; array.label; i ++) {if (i> largest) {i = largest; }} Console.log (biggest);   

The largest number in this array should be cautious, but it seems to be stuck in an infinite loop.

I think you want

 for  (var I = 0; i & lt; array.label; i ++) {if (array [i] & gt; largest) {largest = array [i]; }}   

Basically you are saying "if i is greater than 0, then set from i to 0, which I always want for the option between 0 and 1.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -