As I dive into learning JavaScript, one thing that stumps me is figuring out how to call a function from an event. Currently, the only method I am familiar with involves using anonymous functions (as seen in my code example below), but I'm curious if there's a simpler way to accomplish this. Any tips or insights would be greatly appreciated!
function example (){
document.getElementById("myDiv").onclick = function (){
example2 ();
}
}