I have an array containing the following data:
var arr = [30, "Chad", 400, 700, "Brian", "Zander", "Allen", 43, 50]
I want to sort this array into an array containing just the numbers (from lowest to highest) and another array containing just the strings (in alphabetical order).
I assume I would use a for loop combined with an if/else statement but am not sure of the syntax. Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire