const getTopNTagNames = (n) => { let doms = document.querySelectorAll('*'); let countMap = {};
for (let i = 0, len = doms.length; i < len; i++) { let tagName = doms[i].tagName.toLowerCase(); countMap[tagName] ? countMap[tagName]++ : countMap[tagName] = 1; }
let topN = Object.entries(countMap).sort((a, b) => b[1] - a[1]).slice(0, n); topN.map((value, index, arr) => { arr[index] = value[0]; });