I'm starting to learn JavaScript and I would know how to call a function from an event. The only way I know is with anonymous functions (see my code) and I don't know how to call it in a simpler way. Thanks in advance!
function example (){
document.getElementById("myDiv").onclick = function (){
example2 ();
}
}