Consider:

    Notice that was the duplicate (and thus ignored) declaration, even though it came before the declaration, because function declarations are hoisted before normal variables.

    While this all may sound like nothing more than interesting academic trivia, it highlights the fact that duplicate definitions in the same scope are a really bad idea and will often lead to confusing results.

    However, it’s important to note that this behavior is not reliable and is subject to change in future versions of JavaScript, so it’s probably best to avoid declaring functions in blocks.