Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript string array sort alphabetically

var items = ['réservé', 'premier', 'communiqué', 'café', 'adieu', 'éclair'];
items.sort((a, b) =>
   a.localeCompare(b)//using String.prototype.localCompare()
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #string #array #sort #alphabetically
ADD COMMENT
Topic
Name
7+1 =