The other kind is custom functions. These are functions you create yourself that executes a certain task for you. Creating a function is relatively easy.
Creating Custom Functions
First clear out your script and insert this bit of code.
Let’s update our function to this.
alert( 'Thank you!' );
Next, go to your HTML document and add this bit of code inside your <body> tags.
<button onclick="runBox();">Click Me!</button>
This can be useful for most cases. For example, if you had a login form and you wanted to run some validation on the input fields before submitting it, you can do so by doing it like this.