title: node.js, need help to fix this bug "TypeError: object is not a function"
body: <p>I am learning node.js. trying some demos on cloud9.  the demo is very simple, only 2 js files. I checked line by line, everything seems fine. please help me to debug it.</p>
  
  <ol>
  <li><p>resource.js file.</p>
  
  <pre><code>        var util = require('util');
          var EventEmitter = require('events').EventEmitter;
  
          function Resource(m){
  
              var maxEvents = m;
              var self = this;
  
              process.nextTick(function(){
                  var count = 0;
  
                  self.emit('start');
                  var t = setInterval(function(){
                      self.emit('data', ++count);
  
                      if(count === maxEvents){
                          self.emit('end', count);
                          clearInterval(t);
                      }
                  }, 10);
              });
  
          };
  
          util.inherits(Resource, EventEmitter);
  </code></pre></li>
  <li><p>7-extEmitter.js</p>
  
  <pre><code>        var Resource = require('./resource');
  
  
          var r = new Resource(7);
  
  
          r.on('start', function(){
              console.log("I've started!");
          });
  
          r.on('data', function(d){
              console.log("    I received data -&gt; " + d);
          });
  
          r.on('end', function(t){
              console.log("I'm done, with " + t + " data events.");
          });
  </code></pre></li>
  </ol>
  
  <p>here's the error message I got:</p>
  
  <pre><code>            Your code is running at 'http://node.myw714.c9.io'.
              Important: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts!
              /var/lib/stickshift/511e07b5500446f25c0001bd/app-root/data/407149/7-extEmitter.js:4
              var r = new Resource(7);
  
                ^
              TypeError: object is not a function
                  at Object. (/var/lib/stickshift/511e07b5500446f25c0001bd/app-root/data/407149/7-extEmitter.js:4:9)
                  at Module._compile (module.js:449:26)
                  at Object.Module._extensions..js (module.js:467:10)
                  at Module.load (module.js:356:32)
                  at Function.Module._load (module.js:312:12)
                  at Module.runMain (module.js:492:10)
                  at process.startup.processNextTick.process._tickCallback (node.js:244:9)
  </code></pre>