About 50 results
Open links in new tab
  1. What is the scope of variables in JavaScript? - Stack Overflow

    Feb 1, 2009 · Module - visible within a module Outside of the special cases of global and module scope, variables are declared using var (function scope), let (block scope), and const (block scope). Most …

  2. Block scope, function scope and local scope in Javascript

    Jun 8, 2015 · Is block scope sometimes the same as function scope? I know function scope is for everything inside a function, but don't get what exactly a block scope is. For Javascript, is it currently …

  3. javascript - Difference between function level scope and block level ...

    Dec 24, 2022 · Basically, the difference between function scope and block scope is that in a language that uses function scope, any variables declared within a function are visible anywhere within that …

  4. javascript - What is the difference between "let" and "var"? - Stack ...

    Apr 18, 2009 · Scoping rules The main difference is scoping rules. Variables declared by var keyword are scoped to the immediate function body (hence the function scope) while let variables are scoped …

  5. javascript - what is function scoped variables (var) and block scoped ...

    Mar 31, 2019 · A block is delimited by {} or if those symbols are not present, the enclosing function or, if not in a block or a function, then Global. I've written another post that discusses scope and the scope …

  6. javascript - Explanation of `let` and block scoping with for loops ...

    let introduces block scoping and equivalent binding, much like functions create a scope with closure. I believe the relevant section of the spec is 13.2.1, where the note mentions that let declarations are …

  7. javascript - what is block scope function ECMAScript 6 compare with ...

    Jan 2, 2016 · What is block scope function in ECMAScript 6? Can anyone help me understand the main difference in the block scope function compared to ECMAScript 5?

  8. javascript - What is lexical scope? - Stack Overflow

    Jun 26, 2009 · JavaScript by default does not have block level scope, so inside a for loop is the typical problem. Lexical scope for JavaScript is only at the function level unless the ES6 let or const is used.

  9. Are JavaScript variables declared in the body of an if statement scoped ...

    JavaScript has no "block scope", it only has function scope - so variables declared inside an if statement (or any conditional block) are "hoisted" to the outer scope.

  10. javascript - Can we access a variable declared using 'var' keyword ...

    Dec 8, 2022 · Variables declared with var has global and function scope but does not have block scope. Which means these variables are only accessible inside a function or globally.