Created
April 11, 2018 18:42
-
-
Save tamunoibi/f80fe83131b47220d9bf16da72a5a514 to your computer and use it in GitHub Desktop.
Andela mcq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sort(arr) { | |
arr.sort( function(a, b) { | |
return b.length - a.length;// || //sort by length, if equal then | |
// a.localeCompare(b); //sort by dictionary order | |
}); | |
return arr; | |
} | |
sort(["Abia", "Adamawa", "Anambra", "Akwa Ibom", "Bauchi", "Bayelsa", "Benue", "Borno", "Cross River", "Delta", "Ebonyi", "Enugu", "Edo", "Ekiti", "Gombe", "Imo", "Jigawa", "Kaduna", "Kano", "Katsina", "Kebbi", "Kogi", "Kwara", "Lagos", "Nasarawa", "Niger", "Ogun", "Ondo", "Osun", "Oyo", "Plateau", "Rivers", "Sokoto", "Taraba", "Yobe", "Zamfara"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment