How to find the min length of a string in array of strings in JavaScript

1 Answer

0 votes
const arr = ["javascript", "c#", "c++", "python", "php"];

arr.sort();

const size = arr.length;
   
const min_length = Math.min(arr[0].length, arr[size - 1].length); 

console.log(min_length); 


    
    
/*
run:
    
2
    
*/

 



answered Mar 5, 2021 by avibootz
...