Check array in JS - is list sorted? [duplicate]
  
 
     
     
             
                 
 
 
         
         13 
         
 
         
             3 
         
 
 
 
 
             
 
             
 
     
 
 
     This question already has an answer here: 
      
             Check if an array is descending, ascending or not sorted? 
                 
                     6 answers 
                 
         
         
             Check if array values are ascending or descending 
                 
                     1 answer 
                 
         
      
 I need to create a program that checks the list in the array is sorted. I have three input data:   1,2,3,4,5   1,2,8,9,9   1,2,2,3,2   So here is my code:   let sorts = +gets(); // 3  let list = ;   for (let i = 0; i < sorts; i++) {      list[i] = gets().split(',').map(Number); // The Array will be: [ [ 1, 2, 3, 4, 5 ], [ 1, 2, 8, 9, 9 ], [ 1, 2, 2, 3, 2 ] ]  }   for (let i = 0; i < list[i][i].length; i++){      if (list[i][i] < list[i][i +1...