I am creating a gallery plugin in which I need to find out the number of elements in a simple javascript object. Next, as I would like to be able to create a gallery.
$.Gallery.create($('#galContainer'), { 'img1.png': 'http://linktosomewhere/', 'img2.png': 'http://linktosomewhere/', 'img3.png': 'http://linktosomewhere/', ........ }, optionsObj);
This will put the images in the gallery with the corresponding links to any page when clicked. I am currently using an array for this second parameter with no links, and I am getting the length of the images using images.length. However, using the notation above would be ideal for me, and I would need to find out how many keys are in this object.
I know this post and several others saying that you cannot get the number of elements in an object. If this is true, do you have any suggestions on another way to configure this function call to be efficient and easy to use?
source share