I am looking to scrape a page for any social media links. I wrote some code but I am getting an undefined message in the console. Can anyone help? Autistic and Dyslexic here.
var links = document.querySelectorAll('a');
for (var i = 0; i < links.length; i++) {
if (links[i].href.indexOf('facebook.com') > -1 || links[i].href.indexOf('instagram.com') > -1 || links[i].href.indexOf('youtube.com') > -1 || links[i].href.indexOf('twitter.com') > -1) {
console.log(links[i].href);
}
}