Putting the code directly into the HTML page is an ok solution for small blocks of code.
Use Page -> Edit code to edit the code of the whole page and add
To run the code Refresh the page display by pressing CTRL (CMD on Mac) + R.
You don’t have to save the page before doing Refresh.
Once the script element is added to the page, you can also edit it with Actions -> Edit code (of the selected element). Do Refresh to re-run the code.
For larger chunks of code or more complex code it is better to put the code into a separate .js file and then include the script file in the page with
<script src="..."></script> tag.
Then you can edit the external .js file in an external code editor with syntax highlighting, code completion, etc.
When you want to run the code, save the code in the external editor and simply do CTRL / CMD + R Refresh in Pinegrow. No need to reload anything.