const urls = [
"http://x.com",
"http://y.com",
"http://z.com",
];
for (let j=0; j<urls.length; j++) {
setTimeout(function() {
console.log(urls[j]);
}, 3000);
}
I'm inserting this code snippet into the Chrome inspector. Surprisingly, it spits out a peculiar number followed by a brief pause before showing 3 'undefined' errors on the console.