Here is my JavaScript code:
var all_videos = document.querySelectorAll(".video-feed-item-wrapper");
var all_urls = [];
console.log(all_videos.length);
for(i = 0; i <= all_videos.length; i++) {
all_urls.push(all_videos[i].getAttribute('href'));
}
console.log(all_urls);
It gives me the error all_videos[i] is undefined. Why is it undefined?
Thanks.
ibecomes a global variable uselet,varherefor(i = 0; i <= all_videos.length; i++) {all_videosin that console.log call ?