View Single Post
Old 12-18-2012, 06:05 AM   PM User | #1
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 89
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
Objects question

Hi

Dumb question, but I can't figure this simple thing out...

I have an array of objects:
Code:
var monthlyDP:Array = new Array({label:"1st", X:"first"},{label:"2nd", X:"second"},{label:"3rd", X:"third"},{label:"4th", X:"fourth"},{label:"last", X:"last"});
I know "1st", and want to retrieve the value associated with it (so "first").

Is it a case of having to also know the index of that object, or is there a way to seach and array like this when you know the label of the object, and just want the value?

Thanks!
shaunthomson is online now   Reply With Quote