I have this code:
function Item(id, itemType, itemData, itemCategoryId, itemRank) {
this.id = id;
this.itemType = itemType;
this.itemData = itemData;
this.itemCategoryId = itemCategoryId;
this.itemRank = itemRank;
}
function Category(id) {
this.id = id;
}
And I want to write a function for the Item class which I give it the CategoryId and it will return all items objects with this Category id.
What’s the best way to do that?
I see no array….
I would assume that there would be an items prototype (note that there are no classes in javascript), and it would look something like this: