Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sortArray(input) {
- input.sort(twoCriteriaSort)
- input.forEach(el => console.log(el))
- function twoCriteriaSort(cur, next) {
- if(cur.length > next.length) {
- return 1
- } else if(cur.length < next.length) {
- return -1
- } else {
- return cur > next
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement