Q:

Write a JavaScript program to sort the characters of a string Alphabetically

0

Write a JavaScript program to sort the characters of a string Alphabetically.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join('');

console.log(sortCharactersInString('cabbage'));

console.log(sortCharactersInString('a7fs23l1n4o6x'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now