Calling JS functions from events - no parameters

by danielkwood

HTML

<html>
    <head>
        <title>Functions</title>
        <script src="script.js"></script>
    </head>

    <body>
        <button onclick='sayMessage();'>Click me!</button>
    </body>
</html>

JavaScript

function sayMessage(){
    console.log("Hello world");
}