I have an array into which I insert a load of values along with their corresponding keys. They are inserted fine as I can see them all in the array when I do a console.log.
The issue is, I can't seem to retrieve the values from the array using their respective keys.
Here is my code.
var personArray = [];
personArray.push({
key: person.id,
value:person
});
var personID = person.id;
console.log(personArray.personID);
I have also tried console.log(personArray[personID]; but this does not work either.
The value I get in my console is undefined.