Access values in array

I'm trying to understand this code and how I can access the values that have been added to the array.

Once the values have been added to array, how can I access id and url?
    var photoList = {};
    var toUpload;
    var id = $(this).attr('id');
    var url = $(this).attr('rel');

            toUpload = { id: id, url: url };
            if (id in photoList) {
                delete photoList[id];
            }
            else {
                photoList[id] = toUpload;
            }

Open in new window

LVL 8
JRockFLAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
The basics are here : http://www.json.org/

var photoList = {}; // this is an Object, not an Array 
var toUpload;
var id = $(this).attr('id');
var url = $(this).attr('rel');

toUpload = { id: id, url: url };
for(id in photoList) {
    delete photoList[id];
}
else {
    photoList[id] = toUpload;
}

// HOW TO ACCESS IT
var ID_out_of_the_blue = 1; 
myUpload = photoList[ID_out_of_the_blue]; // if there's one with 1 you get back the object

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JRockFLAuthor Commented:
Go it. thank you.
0
leakim971PluritechnicianCommented:
'welcome!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.