Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(array) {
- array.sort((a, b) => a.localeCompare(b)) // sort in Ascending order
- .forEach((element, index) => {
- console.log(index + 1 + '.' + element)
- });
- }
- solve(["John", "Bob", "Christina", "Ema"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement