I am new to this board have been fishing for info here for a long time and this is my first time posting here. I am in sort of a jam right now I have an array in javascript that looks like this. Each ID is accociated with a persons name
Array
(
[230] => Smith, Marc-Andre
[11369] => Smith, Wayne
[12561] => Smith, Diane
[12637] => Smirnova, Natalie
)
Right now the array is sorted by the index which is the ID of the person. I am wondering if its possible to sort it alphabetically such that the array now looks like
Array
(
[12637] => Smirnova, Natalia
[12561] => Smith, Diane
[230] => Smith, Marc-Andre
[11369] => Smith, Wayne
)
So far I tried using array.sort() it does sort alphabetically but the ID is lost it gives me
Array
(
[0] => Smirnova, Natalia
[1] => Smith, Diane
[2] => Smith, Marc-Andre
[3] => Smith, Wayne
)
This is my first time programming javascript so thanks for all the help in advance.