I keep trying to pull the email addresses out of an array of links using filter by text. This is the code I tried that is not working. I'm sure I'm missing something simple, any ideas?
let links = Array.from(document.getElementsByTagName('a'));
let subset = links.filter(getEmails);
function getEmails(email) {
return subset.includes('@');
}
Filter doesn't work like that. The callback for the filter method gets each element.
let links = Array.from(document.getElementsByTagName('a'));
let subset = links.filter(getEmails);
function getEmails(link) {
return link.includes('@');
}