Given the array of object below:
function person(first, last, RPI, o, t, u) {
this.first = first;
this.last = last;
this.RPI = RPI;
this.o = o;
this.t = t;
this.u = u;
}
var MD = new person('Mike', 'D', 1234, '', '', '');
var AY = new person('Adam', 'Y', 5678, '', '', '');
var AH = new person('Adam', 'H', 1212, '', '', '');
var personArray = new Array(MD, AY, AH);
How would I iterate the RPI value from each object into this formula?
function selector(x){
//do something with x.RPI
}
I've tried:
$.each(personArray , selector (personArray[person].RPI){
selector(x)
});
But it doesn't work. What am I doing wrong with my each statement?
personArray = {MD, AY, AHR, DD};is not an array. Typo?