The instructions for the library used by the answer can be found here (you don't need step 5). Once you do that you should create a folder with an html page and the script you created. Add to the html page
<script src="bitcoinjs.js"></script>. Open the html file in your browser, then you should be able to run your script.
This guide in particular walks you through the process: https://bcoin.io/guides/webapp.html
Please note that web browsers are insecure environments for cryptography and especially cryptocurrency, this guide is based around public keys and testnet addresses to avoid any real risk. If you try to manage private keys in a browser's JS environment you need to be extremely careful (use an offline computer if possible, no "chrome extensions" etc)