title: require difference in javascript(spidermonkey) and nodejs
body: <p>in  javascript(spidermonkey) </p>
  
  <p>//t1.js</p>
  
  <pre><code>var a=function(){
  
  
  };
  
  a.prototype.dosomething=function(){
      console("t1");
  
  }
  </code></pre>
  
  <p>t.js</p>
  
  <pre><code>require ('t1.js');
  var b1=new a();
  b1.dosomething();
  </code></pre>
  
  <p>it equals:</p>
  
  <pre><code>var a=function(){
  
  
  };
  
  a.prototype.dosomething=function(){
      console("t1");
  
  }
  var b1=new a();
  b1.dosomething();
  </code></pre>
  
  <p>but in node.js</p>
  
  <p>t.js</p>
  
  <pre><code>require ('./t1.js');
  var b1=new a();
  b1.dosomething();
  </code></pre>
  
  <p>it reports error:</p>
  
  <p>node t.js</p>
  
  <pre><code>t.js: 
  var b1=new a();
             ^
  ReferenceError: a is not defined
      at Object.&lt;anonymous&gt; (/Users/mymac/js/t.js:16:12)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:906:3
  </code></pre>
  
  <p>Your comment welcome</p>