Right now I have something like
const route = '/Images/Banner/'
const slides = [
{
name: "banner-01",
url: `${route}banner-01.png`
},
{
name: "banner-02",
url: `${route}banner-02.png`
},
{
name: "banner-03",
url: `${route}banner-03.png`
},
]
]
In this, I’m manually adding each image and it’s properties because there are only 3 images, but i want to dynamically add them based on the quantity of images with the same name (they’ll always are going to be named banner-NN).
Is there an efficient way to iterate through images with the same pattern of name (‘banner-‘) and place them in an array of objects?