title: Why does JavaScript behave like synchronous without web API call
body: <p>I know JavaScript is synchronous by nature. So that when I call a function with web API It performs synchronously:</p>
  <pre><code>setTimeout(function(){
    console.log('1');
  }, 2000);
  
  console.log('2');
  </code></pre>
  <p>it will print  '2' then '1'.</p>
  <p>But when I run a loop like for loop and increase the iteration it executes synchronously:</p>
  <pre><code>var first = function(){
      for(var i=0;i&lt;=100000000;i++){
          if(i==100000000){
              console.log('first')
          };
      };
  };
  
  var second = function() {
      console.log('second')
  };
  
  var a = function() {
      first();
      second();
  }
  
  a();
  </code></pre>
  <p>It will print the first second respectively.</p>
  <blockquote>
  <p>So, is JavaScript performing synchronously with native code?</p>
  </blockquote>