About 10,800,000 results
Open links in new tab
  1. 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 …

  2. javascript - What is the purpose of the var keyword and when …

    Apr 13, 2012 · Since variable declaration creates property with the DontDelete flag, the difference between var x = 1 and x = 1 (when executed in global scope) is that the former one - variable …

  3. JavaScript OR (||) variable assignment explanation

    That is, JavaScript "short-circuits" the evaluation of Boolean operators and will return the value associated with either the first non-false variable value or whatever the last variable contains.

  4. What does 'var that = this;' mean in JavaScript? - Stack Overflow

    Feb 3, 2011 · In a JavaScript file I saw: function Somefunction(){ var that = this; ... } What is the purpose of declaring that and assigning this this to it?

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

    Apr 13, 2023 · Closed 2 years ago. New to JavaScript and a beginner. I came across JavaScript variables and realized there are three different ways to go about them (var, let and const). Do …

  6. How can I check for "undefined" in JavaScript? - Stack Overflow

    The in operator checks for the existence of a property, regardless of its value, while the question at least appears to be asking how to test if the value of a variable is undefined. Perhaps a …

  7. setting a javascript variable with an if statement -- should the 'var ...

    setting a javascript variable with an if statement -- should the 'var = x' be inside or outside the IF? Asked 10 years, 2 months ago Modified 2 years, 5 months ago Viewed 66k times

  8. Javascript How to define multiple variables on a single line?

    If I want to condense code, what's the proper JavaScript "strict" way to define multiple javascript variables on a single line? var a = 0; var b = 0; var a = b = 0; var a = var b = 0;

  9. Define a global variable in a JavaScript function

    With regards to JavaScript in a browser environment, a global variable and a property of window are synonymous. Either way, the semantic distinction you're making is clear, so I don't mind un …

  10. Finding Variable Type in JavaScript - Stack Overflow

    193 In Java, you can use instanceOf or getClass() on a variable to find out its type. How do I find out a variable's type in JavaScript which isn't strongly-typed? For example, how do I know if the …