sort an array by the laster letter of element javascript

Solutions on MaxInterview for sort an array by the laster letter of element javascript by the best coders in the world

showing results for - "sort an array by the laster letter of element javascript"
Matteo
23 Sep 2016
1function last(arr){
2    return arr.sort((a, b) => a.charCodeAt(a.length - 1) - b.charCodeAt(b.length - 1));
3}
4