sort array by length of strang javascript 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);
}