When I log the code snippet below in the console:
const returnedValue = Array.from(
{ length: 2 / 0.25 },
(_, i) => +((i + 1) * 0.25).toFixed(2),
).map((item) => ({ value: item, unit: "usd" }));
The output I receive is:
1: {value: 0.5, unit: 'usd'}
2: {value: 0.75, unit: 'usd'}
3: {value: 1, unit: 'usd'}
4: {value: 1.25, unit: 'usd'}
5: {value: 1.5, unit: 'usd'}
6: {value: 1.75, unit: 'usd'}
7: {value: 2, unit: 'usd'}
I need the values to be returned as numbers.
How can I modify the code to round all values to 2 decimal places, including 0.5, 1, 1.5, and 2?
Thank you.