Reputation: 1087
How to remove duplicates in [].map()
. a.href
may contain the same href
link, how can I stop this reoccuring data? EXAMPLE: www.example.com | www.example.com
const hrefs = await page.evaluate(() => {
const anchors = document.querySelectorAll('a');
return [].map.call(anchors, a => a.href);
});
Upvotes: 1
Views: 135
Reputation: 31761
Set hrefs = new Set([].map.call(anchors, a => a.href));
return [...hrefs];
Upvotes: 3