js sort string by length code example
Example: sort array by string length javascript
function sortByLength(arr) {
return arr.sort((x,y) => x.length - y.length);
}
function sortByLength(arr) {
return arr.sort((x,y) => x.length - y.length);
}