I need to create an array based on number which is my limit. So below is my input and this the expected output I am looking out
Input
3
Expected output
[{value: 3, label: 3}, {value: 2, label: 2}, {value: 1, label: 1}, {value: 0, label: 0}]
Tried this
Array(3).map((_, i) => ({value: i, label: i }))
But this didn't worked, any help is appreciated
[...Array(n+1)].map((x, i) => ({ value: n-i, label: n-1}));wherenis your input number (for example:3).