title: Functions may be declared only at top level in strict mode
body: <p>I have this error when using FireFox with strict mode. But am unsure what it means. I assumed it meant that the function had to be declared before it was called upon but the error still occurs.</p>
  
  <blockquote>
    <p>SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function</p>
  </blockquote>
  
  <p>This is my snippet of code where it is causing the error:</p>
  
  <pre><code>var process = new function(){
  
    var self = this;
  
    self.test = function(value,callback){
      var startTime = Date.now();
  
       function update(){     //&lt;--- error is here
                  value++;
                  startTime        = Date.now();
  
                  if(value &lt; 100){ 
                      setTimeout(update, 0);
                  }
                  callback(value);
      }       
      update();
    }
  
  };
  </code></pre>
  
  <p>So i'm wondering how would I write this snippet of code out correctly with strict ? What does it mean by top level ? Does that mean globally defined and not locally within a function ?</p>
  
  <p>Also given I have <code>use strict</code> why does this problem not occur in Chrome?</p>