Content available under a Creative Commons license. The code then prints the reference to the console, which is simply the HTML for defining the button: Now that we have a reference to the element, we can use the reference to assign an event handler. We are not expecting you to understand all of these areas now, but it certainly helps to understand the basics of events as you forge ahead with learning web development. We use an ifelse statement here. Should I include the MIT licence of a library which I use from a CDN? The same result can be achieved with a function expression: The code above uses a function expression to store the handler function in a variable const greeting. The above example assigns the variable const greeting as the onclick handler for the Click me button. The onclick event executes a certain functionality when a button is clicked. This could be when a user submits a form, when you change certain content on the web So we need to write it in a JavaScript file, or in the HTML file inside a