[Solved] javascript/jquery get lowest number


I want to get lowest index but I can’t do that

Sure you can: 0

The lowest index of any array is going to be 0 in JavaScript.


If you have an array of values, you can get the min as so:

var arr = [3,1,4];
Math.min.apply(Math, arr);  // returns 1

Given your codepen example (which you should include in your question):

var indexes = [];
$("div").each(function(i){
   if(!$(this).hasClass("lo")){
     indexes[indexes.length]=i;
   }
});


console.log("Matches: ", indexes);
console.log("Min: ", Math.min.apply(Math,indexes));

5

solved javascript/jquery get lowest number