I have a piece of code making use of Jquery's click() event handler below.
//advance automaton by one step
 $('#nextstep').click(function() {
  if (canAdvanceAutomaton) {
   runAutomaton(logicalGrid);
  }
 });I thought that .click() accepts an anonymous function, so I tried changing my code to the one below.
//advance automaton by one step
 $('#nextstep').click = () => {
  if (canAdvanceAutomaton) {
   runAutomaton(logicalGrid);
  }
 };I believed these two pieces of code would be equivalent, but it turns out the latter version doesn't run my canAdvanceAutomaton function when I click the html id with #nextstep, and I don't see any errors in the console. Can anyone tell me why these two ways of calling .click() are not equivalent?
 
     
    