2 ms·
Neat! Noob question: is there a similar way to dump it to JSON, instead of a table?
by runjake 5y ago
Neat!
Noob question: is there a similar way to dump it to JSON, instead of a table?
- chair6 5y agoJust replace console.table with JSON.stringify for the quick-and-easy dump of exactly the same data as is in the table... JSON.stringify([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a)))
- AntonyGarand 5y agoReplace `console.table` with `JSON.stringify`: JSON.stringify([...document.querySelectorAll('.fatitem table .athing')].map(el => [el.textContent.trim(), el.nextSibling.textContent.trim()]).sort(([,a], [,b]) => parseInt(b) - parseInt(a)))