Ad
  • Custom User Avatar

    To return a function, you simply... return a function!! :)

    For example:

    function MagicFunction(...a) {
      function toBeReturned(...a) {
        do {
          // this code...
        } while (somethingIsTrue);
        return something;
      }
    
      return toBeReturned;    // This is how to return a function..
      return toBeReturned();  // This would be, instead, returning a function invocation..
    }
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution