At first. It is incorrect to create an array to use as a match. Use Object instead:
var status = {}; status['BOB'] = 10;
An array is a class with logic for processing numeric sequential indices.
Now, in answering your answer, the comparisons are not in order, there is no guarantee that it will be iterated, so there is no such thing as “sorting a display”
I suggest you use an array with objects with a key, value:
var status = []; status.push({ key: 'BOB', value: 10 });
Or two arrays:
var status = { keys: [], values: [] }; status.keys.push('BOB'); status.value.push(10);
It depends on your needs.
A. Matías Quezada Oct 08 '12 at 19:26 2012-10-08 19:26
source share