Show duplicate IDs

const dupes = Object.entries( [...document.querySelectorAll("[id]")] .map((x) => x.id) /* get all ids */ .reduce( (acc, id) => ({ ...acc, [id]: (acc[id] || 0) + 1 }), {} ) /*count them*/ ).filter(([_key, val]) => val > 1); /* find the ones repeating more than once */ console.warn(dupes);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.