Change this to the following and it will work:
html:
<button id="myButton">Click me</button>
<script src="script.js"></script>
script.js:
document.getElementById("myButton").addEventListener("click", myFunction);
function myFunction(){
console.log('change this function to your function');
}