title: JavaScript/jQuery: How to Chain a Method that uses console.log()
body: <p>I'm playing around with jQuery plugin development, and I'd like to chain methods. I read in the jQuery tutorial (<a href="https://learn.jquery.com/plugins/basic-plugin-creation/" rel="nofollow">https://learn.jquery.com/plugins/basic-plugin-creation/</a>) that you can chain methods by adding <code>return this;</code> to the end of the method, and that works for the first method (test 1). How can I do that for the second method (test 2), which uses <code>console.log</code>? Can all methods be chained?</p>
  
  <pre><code>   // test 1
      $.fn.greenify = function () {
          this.css('color', 'green');
          return this;
      };
  
      // test 2
      $.fn.console = function () {
          this.on('click', function () {
              console.log('hello world');
          });
      };
  
      $('a').greenify().console();
  </code></pre>