I am trying to populate an array with the text value of a json obejct based off values from another array
my code is:
var DemoOptions = {
"One" : 1,
"Two" : 2,
"Three" : 3,
"Four" : 4,
"Five" : 5
};
var OldArray = [1,3,5];
var NewArray = [];
$.each(OldArray,function(x, item){
NewArray.push(DemoOptions.item);
});
NewArray should now be:
NewArray ["One", "Three", "Five"]