const minutes = [
{
value: "00",
id: 1,
},
{
id: 2,
value: "05",
},
{
id: 3,
value: "10",
},
{
id: 4,
value: "15",
},
{
id: 5,
value: "20",
},
{
id: 6,
value: "25",
},
{
id: 7,
value: "30",
},
{
id: 8,
value: "35",
},
{
id: 9,
value: "40",
},
{
id: 10,
value: "45",
},
{
id: 11,
value: "50",
},
{
id: 12,
value: "55",
},
];
How can i make like this dynamically
From luk2302's comment to implement,
let arr = [] for (let i = 0; i < 12; i++) { arr.push({ id: (i + 1).toString(), value: (i * 5).toString() }) } console.log(arr)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.