I mistakenly wrote a re-declaration of an argument as a const in a function and instead of throwing SyntaxError: Identifier 'bar' has already been declared I ended up with ReferenceError: bar is not defined..  
What causes this behaviour? It wasn't the expected error, and left me confused for a few minutes.
Example code:
function foo(bar) {
  try {
      console.log(bar);
      const bar = 123;
  } catch(err) { console.log(err) }
}
foo(456);
If I don't wrap the declaration in a try/catch, I get (what I believe to be) the expected error.
 
     
     
     
     
    