title: Why no "unreachable" statement error/warning shown in Javascript?
body: <p>I am coming from a Java background. In java if I have a method like below:</p>
  
  <pre><code>public static String foo()
   {
       return "foo";
       System.out.println("x");
   }
  </code></pre>
  
  <p>I will get Compilation error :</p>
  
  <pre><code>error: unreachable statement
           System.out.println("x");
  </code></pre>
  
  <p>Now I understand that JS,and Java is totally different language. But I wanted to be sure, if what I understood is correct.</p>
  
  <p>Following code works, fine without any error, warning (I read that in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Stmt_after_return" rel="nofollow noreferrer">Firefox</a>, we do get warning)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"use strict";
  function createIncrementor() {
      console.log('Logging before return .. ' );
      return 3;
      console.log('Logging.. after return' );
  }
  var inc = createIncrementor();
  console.log(inc);</code></pre>
  </div>
  </div>
  </p>
  
  <p><code>console.log('Logging.. after return' );</code> is ignored, without Warning/Error or so in Normal run. I saw that ESlint has a rule to check this.</p>
  
  <p>So question is :</p>
  
  <p>Is this expected or I need to enable some setting/config (use strict didn't do anything though)? To check such errors, what is the recommendation? Always use ESLint?</p>