What I"m trying to accomplish is similar to the PHP solution from this other post on Stackoverflow, but with JavaScript:
Multidimensional array, find item and move to the top?
I'm returning an object with the following:
$.get(uri, function (data) {
self.options = [];
$.each(data, function (index, item) {
self.options.push(item);
});
});
self.options[] looks something like:
Object 1:
Id: "1"
Name: "Bill"
Object 2:
Id: "2"
Name: "Sarah"
Object 3:
Id: "3"
Name: "Mike"
I need to find "Sarah" in the array object and move it up to be the first item of the array. How can I accomplish this?*