Created
April 29, 2019 18:09
-
-
Save mtliendo/9a6c127cfc6b239ddf551febfa8dfc58 to your computer and use it in GitHub Desktop.
An quick intro to understanding callback functions via forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First let's grab a form | |
console.log('first') | |
const someForm = document.getElementById('some-form') | |
// Next, we'll add an event listener with the event and a callback function | |
// Note that the anonymous function is | |
someForm.addEventListener('submit', (evt) => { | |
console.log('second') | |
//this is an asynchronous function. | |
}) | |
console.log('third') | |
// Note that the log statements will be "first", "third", "second" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment