About 52,500 results
Open links in new tab
  1. javascript - What is the difference between "let" and "var"? - Stack ...

    Apr 18, 2009 · The use of "let" just defers this problem. So each iteration creates a private independent block scope, but the "i" variable can still be corrupted by subsequent changes …

  2. When should you use "var", "let", or "const" in JavaScript code

    Apr 13, 2023 · I came across JavaScript variables and realized there are three different ways to go about them (var, let and const). Do they each have a specific purpose or you can just use …

  3. javascript - When should I use let and var? - Stack Overflow

    Feb 20, 2014 · Hi @MattBrowne. Thanks for the link, but I don't think the article makes a very good case. Basically what it says is: (1) if you use a variable before declaring using let, your …

  4. ¿Cual es la diferencia de usar LET en vez de VAR en JavaScript?

    let permite declarar variables limitando su alcance (scope) al bloque, declaración, o expresión donde se está usando. Lo anterior diferencia la expresión let de la palabra reservada var , la …

  5. 'let' vs 'var' in javascript for loops, does it mean that all the for ...

    May 23, 2017 · Since according to What's the difference between using "let" and "var" to declare a variable?, the let keyword has a smaller scope than var when …

  6. javascript - Understanding let vs. var hoisting - Stack Overflow

    The main difference between var and let is that: var is hoisted to the wrapping function block. let is hoisted to the wrapping {} block. The second code sample doesn't have the same reference …

  7. javascript - Should you use 'var' or 'let' in the global scope? - Stack ...

    Aug 14, 2018 · In your case (Node.js), neither var nor let make a global scope variable; both will create a module-scope variable (accessible inside this module, but not in other modules). This …

  8. Is there a reason not to replace `var` with `let` in JavaScript?

    Oct 15, 2016 · From what I've read, the var is left in ES6 for backwards compatibility. Most of the articles I've read advise to gradually replace all var occurrences with let. Of course, this should …

  9. Let or Var in modern javascript? - Stack Overflow

    Aug 15, 2018 · In modern JS, use let or const whenever possible and appropriate. The semantics match more closely those how variables and constants work in other programming languages, …

  10. javascript - What is the difference between 'let' and 'const ...

    Let cannot be redeclared while var can support and it will assign last declared value. Hoisting. str="prod" console.log(str) var str // str2="prod", console.log(str2), // let str2 (not allowed) …

Refresh