JavaScript Does Not Support Block Scope

by sikusikucom

JavaScript

function hello() {

    { var greeting = 'Hello'; }

    // 'greeting' is accessible here although it is declared
    //   in a different block.
    // In a language that supports block scope, 'greeting' would have
    //   *not* been visible from this point.        
    console.log(greeting);
}
hello();