It can't be done with JavaScript and I don't think it can be done using a web browser.
You'd need a separate program that can read web pages and convert them to text that runs outside of a browser. I don't know if such a program exists - probably not given the copyright issues associated with making it easier to steal text from web pages.
I want to count specific text strings in a web pages. So i thought it would be easier to download, search, count and deleted file would be easier that count online.
If second solution is easier i wouldn't know