Answers for "array sort by alphabetical javascript"

6

alphabetical order array javascript

arr.sort(function(a, b) {
    return a === b ? 0 : a < b ? -1 : 1;
  });
Posted by: Guest on August-11-2020
6

array sort by alphabetical javascript

users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Posted by: Guest on August-29-2020
2

javascript sort array strings alphabetically

//sort array alphabetically
objArray.sort(function(a, b) {
   return a.localeCompare(b);
});
Posted by: Guest on September-23-2020
1

javascript sort array in ascending order

//sorts arrays of numbers
function myFunction() {
  points.sort(function(a, b){return a-b});
  document.getElementById("demo").innerHTML = points;
}
Posted by: Guest on March-25-2020
-1

put array in alphabetical order

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
Posted by: Guest on February-09-2020

Code answers related to "array sort by alphabetical javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language