title: How to return value from anonymous function in js
body: <p>I would like to return value from anonymous function. How can I assign returned value to $id variable in below code ?</p>
  
  <pre><code>$(document).on("click", '.delete-component', function(e) {
       return 4;
   });
  
   //$id in this scope should be equal 4
  </code></pre>