About 169,000 results
Open links in new tab
  1. javascript - Declaring vs Initializing a variable? - Stack Overflow

    Jul 30, 2015 · Thus, initialization isn't a term that matters to us. We declare and assign, and the Javascript engine initializes. So to directly answer the example in your question: var example; …

  2. javascript - Declaring variables without var keyword - Stack Overflow

    In that case you should declare them using the var keyword outside the functions, to make it clear that you really want to create global variables, and didn't just forget the var when trying to …

  3. Define a global variable in a JavaScript function

    691 Is it possible to define a global variable in a JavaScript function? I want use the trailimage variable (declared in the makeObj function) in other functions.

  4. How to declare a global variable in JavaScript - Stack Overflow

    Oct 15, 2020 · How can I declare a global variable in JavaScript?If this is the only application where you're going to use this variable, Felix's approach is excellent. However, if you're writing a …

  5. Best Way for Conditional Variable Assignment - Stack Overflow

    There are two methods I know of that you can declare a variable's value by conditions. Method 1: If the condition evaluates to true, the value on the left side of the column would be assigned to …

  6. How do I declare and use dynamic variables in JavaScript?

    Suppose I need to declare a JavaScript variable based on a counter, how do I do so? var pageNumber = 1; var "text"+pageNumber; The above code does not work.

  7. JavaScript: Dynamically Creating Variables for Loops

    How can I use a for loop to dynamically create variables, and be returned.

  8. javascript - Can I set variables to undefined or pass undefined as …

    Javascript has a delete operator that can be used to delete a member of an object. Depending on the scope of a variable (i.e. if it's global or not) you can delete it to make it undefined.

  9. javascript - var functionName = function () {} vs ... - Stack Overflow

    Dec 3, 2008 · By using the variable syntax, I can declare the variable (a function pointer essentially) in the shared code and either assign a trivial stub function, or set to null.

  10. javascript - What is the correct way to define global variable in ES6 ...

    Apr 25, 2017 · I can't seem to find a description of the way I should export global variable from ES6 module. Is there a resource where it's defined? The only solution that seems to work is …