1<button id="button">Button</button> <!-->Creates a new button.</!-->
2<script>
3 const button = document.querySelector("#button"); //Finds the button by id.
4 button.addEventListener("click", e => { //Runs the function (doesn't have to be an arrow function, just a function.) whenever said button is clicked.
5 e.preventDefault(); //Stops said button from reloading the page.
6 }
7</script>