How can I limit this MAP, so that I only search the first 3 items, cleanly?
const Xx = actives.map(it => ({
x: it.ticker,
y: it.percent,
label: it.percentual,
}));
How can I limit this MAP, so that I only search the first 3 items, cleanly?
const Xx = actives.map(it => ({
x: it.ticker,
y: it.percent,
label: it.percentual,
}));
const arr = [{id: 1}, {id: 2}, {id: 3}, {id: 4}];
const Xx = arr.slice(0, 3).map(el => ({
x: el.id,
}));
console.log(Xx)