A Method Set a Minimum and maximum limit based on array length (JavaScript)

In this method we can use the following code , if we want to iterate a loop maximum to 5 iterations and a minimum of the length of a particular array in the code.

Code snippet:

  var maxIterations = Math.min(array.Length, 5);

Leave a comment

Your email address will not be published. Required fields are marked *