() at the end of a wordfunction()(), or may have optional parameterskeydown event & logKey example
logKey function to record keystrokes, you can just pass the function directly into another function like so:// Declaring a Separate Function
function logKey(event) {
console.log(`You pressed "${event.key}".`);
}
textBox.addEventListener('keydown', logKey);
// Passing the function directly with Anonymous Function
textBox.addEventListener('keydown', function(event) {
console.log(`You pressed "${event.key}".`);
});
functiontextBox.addEventListener('keydown', (event) => {
console.log(`You pressed "${event.key}".`);
});