rse / es6-features

ECMAScript 6: Feature Overview & Comparison

Home Page: https://rse.github.io/es6-features/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Block-Scoped Functions code is wrong.

webbedspace opened this issue · comments

commented

This is wrong. That code depicts function-scoped functions. It should actually be this:

{
    function foo() {...}
    foo();
    {
        function bar() {...}
        bar();
    }
}

ES5:

function foo() {...}
function bar() {...}
{
    foo();
    {
        bar();
    }
}

Good catch. Thanks for the hint. I've revised the stuff and now showcase both Function-Scoped Functions and Block-Scoped Functions. How it is correct now.