title: Why is variable declaration not allowed as a parameter, but function declaration is?
body: <p>It might be a dumb question. I googled it but can't find the answer. Variable declaration is not allowed as parameter of a function as below.</p>
  
  <pre><code>function t(a) {
      alert(a);
  }
  
  t(var x = 1); // Uncaught SyntaxError: Unexpected token var
  t(let x = 1); // Uncaught SyntaxError: missing ) after argument list
  t(x = 1); // working fine and later I am able to access x also
  console.log(x); // printing 1
  </code></pre>
  
  <p>But function declaration is being allowed as a parameter of a function as below.</p>
  
  <pre><code>function callback(str, f1, f2) {
      if(str == "")
          f1();
      else
          f2();
  };
  
  callback("", function b1() { alert("empty") }, function b2() { alert("not empty") }); // working fine
  
  b1(); // Throwing error Uncaught ReferenceError: b1 is not defined
  </code></pre>
  
  <p>Can anyone please help me to understand</p>
  
  <ul>
  <li>Why variable declaration is not allowed as a parameter of a function
  but function declaration is allowed as parameter?</li>
  <li>Why we can't access the function which is declared as a function
  parameter outside of the function call?</li>
  </ul>