Javascript Array Sort | How to sort an array with string and numbers
As you know JavaScript sort() function is for sort an array alphabetically. before getting to javascript array sort with string and numbers. let’s learn simple javascript array sort. const vehicles = [“Car”, “Bus”, “Van”, “Lorry”, “Bike”]; vehicles.sort(); //Output -> [“Bike”, “Bus”, “Car”, “Lorry”, “Van”] As you can see the sort() method sorts an array alphabetically. […]