4 ms·
Here's my version using a different "command line": chrome devtools Object.entries(document.body.innerText.replace(/[^a-zA-Z\s]/g, '').toLowerCase().split(/\s+
by tln 8y ago
Here's my version using a different "command line": chrome devtools
Object.entries(document.body.innerText.replace(/[^a-zA-Z\s]/g, '').toLowerCase().split(/\s+/).reduce((o, word) => {o[word] = (o[word] || 0) + 1; return o}, {})).sort((a,b) => b[1] - a[1]).slice(0, 10)
Plain JS is missing some niceties, but being able to crunch some data from a website using the same iterative approach as a shell command line has its place!
- pcnix 8y agoThis is pretty cool, I haven't really used the console for something like this in a while, and it's a good reminder for its power.