Heres is how I add data to my object:
let trade = [
new RecordStock(elem, recordtime, stockquantity, tradetype, stocksymbol),
]
The problem is when I run this:
console.log(trade[0].price);
It seems that overwrites my object from the beginning.
I add my class code. How i can print the first data from the object
class RecordStock {
constructor(price, timestamp, stockquantity, tradetype, stocksymbol) {
this.price = price;
this.timestamp = timestamp;
this.stockquantity = stockquantity;
this.tradetype = tradetype;
this.stocksymbol = stocksymbol;
}
static recordTrade(){
console.log(price[0]);
}
}