I have an array of URLs and I want to open all these URLs one by one in the new tab with the specified delay. I have tried the below method, but it opens all URLs in a one-shot after a delay of 2 seconds. Please suggest the code changes.
items = ["a.com", "b.com", "c.com", "d.com"]
items.forEach((url, index) => {
if (index <= 49) {
setTimeout(() => { window.open(url, "_blank"); }, 2000);
}
})