var fruits = [];
fruits[0] = {name:"apple", stock:"1box"}
fruits[1] = {name:"banana", stock:"2box"}
fruits[2] = {name:"banana", stock:"3box"}
so in case of this object is there any simple way to add new field inside of list like this? for example
fruits[0] = {name:"apple", stock:"1box", **taste:"good"**}
like this.
i tried create new template and copy original data and paste to the new template, for example
function fruit_2(name, stock, taste){
this.name = name;
this.stock = stock;
this.taste = taste;
}//create new template
and re-add element from the fruit[0] and then fruit[1] to new template like this
but i was wondering if there is easier or faster way.
thank you for reading my question.
i will appreciate any help! thanks!