First of all, javascript newb here and working on a little pet project to try to get better at this. I am building an Image object
function Image (id, name, height, width) {
this.id = id;
this.name = name;
this.height = height;
this.width = width;
}
The first order of business is writing the id and name which I can do.
var image = new Image(
json.revision_images[i].id,
json.revision_images[i].OrgImageName,
json.revision_images[i].galleryid
);
My next step is adding the height and width to each instatiation of the object, this is where I have a problem wrapping my head around the object concept.
I have a little function that is getting the natural height and width of the referencing thumbnail.
function checkImageDimensions (id)
{
var img = $("#" + id);
naturalDimension = getNatural(img);
}
How do I go about assigning
this.height = naturalDimension.oHeight;
this.width = naturalDimension.oWidth;
to the object based on id?