i'm trying to create items in canvas for a website that i'm creating. While using an Object and Array push I used an Alert to indicate me what's in the Array but it tells me that it's undefined. Any suggestion on how I can fix that or did I do something wrong in my JS. Thank you
function products(tag, name, price, src, description){
this.Tag = tag;
this.Name = name;
this.Price = price;
this.Src = src;
this.Description = description;
}
var product = [];
product.push = new products(tag,"name", price, "path/to/my/item", "description");
When I do this with all my real informations and I do a "alert(product[0].name)" it doesn't show me the name it gives me an "Cannot read property 'name' of undefined" error and when I do a "alert(product[0])" theres an alert but it tells me "Undefined".