Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sortingBy2Criteria(arr) {
- arr.sort((a, b) => {
- if (a.length === b.length) {
- return a.localeCompare(b)
- }
- return a.length > b.length ? 1 : -1;
- });
- console.log(arr.join('\n'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement