0

I'm trying to run this loop

var max_number= $("input[name='max_number']").val(); 
var min_number= $("input[name='min_number']").val(); 

for(var j=max_number;j>=min_number;j--)
{  
  console.log('j value' + j);
}

max_number is 10 & min_number is 8 then for loop is not executing when i change it to j=max_number-1

for(var j=max_number-1;j>=min_number;j--)
{  

    console.log('j value' + j);
}

but i want to start it with max_number

i want that loop should be executed like this :

if max_number is 12 and min number is 2 Output :

12 11 10 9 8 7 6 5 4 3 2

Any solution, Thanks

user3653474
  • 3,393
  • 6
  • 49
  • 135

0 Answers0