Calling JS functions from events - with parameters

by danielkwood

HTML

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

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

JavaScript

function sayMessage(message){
    console.log(message);
}