Skip to content

Instantly share code, notes, and snippets.

@mvark
Created November 15, 2023 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvark/2670ba308777bfb689d9711504c895dc to your computer and use it in GitHub Desktop.
Save mvark/2670ba308777bfb689d9711504c895dc to your computer and use it in GitHub Desktop.
javascript:function e(){const t=200,n=e=>e?e.split(/\s+/).length:0,o=(e,t,n)=>{const o=e/t,r=n/e;return.39*o+11.8*r-15.59},r=()=>window.getSelection().toString().trim()||document.body.innerText.trim(),s=r(),l=n(s),a=Math.ceil(l/t),i=s.split(/[.!?]+/).length,c=s.split(/[aeiouy]+/i).length-1,d=o(l,i,c);alert(`Word Count: ${l}\nReading Time: ${a} min\nReadability Level (Flesch-Kincaid Grade Level): ${d.toFixed(2)}`)}e();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment