In my programming project, I am working with two classes: Candles
and Candle
. The Candles
class includes a property called list
, which is an array containing instances of the Candle
class.
class Candles
{
public list: Array<Candle>;
}
class Candle
{
public date: number;
public high: number;
public low: number;
public open: number;
public close: number;
public volume: number;
}
I aim to encapsulate the list
property within the Candles
class. For instance,
const candles = new Candles();
candles[3] === candles.list[3];
My goal is for candles[3]
to refer to candles.list[3]
Additionally, I want to utilize the map function. Here's an example:
candles.map(function(candle: Candle) {
console.log(candle.high);
});