Région de recherche :

Date :

https://stackoverflow.com › questions › 8260156

javascript - How do I create dynamic variable names inside a loop ...

I'm working on an ajax google maps script and I need to create dynamic variable names in a for loop. for (var i = 0; i < coords.length; ++i) {. var marker+i = "some stuff"; } What I want to get is: marker0, marker1, marker2 and so on. and I guess there is something wrong with marker+i.

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Loops_and_iteration

Loops and iteration - JavaScript | MDN - MDN Web Docs

Loops offer a quick and easy way to do something repeatedly. This chapter of the JavaScript Guide introduces the different iteration statements available to JavaScript.

https://developer.mozilla.org › fr › docs › Web › JavaScript › Guide › Loops_and_iteration

Boucles et itérations - JavaScript | MDN - MDN Web Docs

Ce chapitre du guide JavaScript présente les différentes instructions qu'il est possible d'utiliser en JavaScript pour effectuer des itérations. Les boucles permettent de répéter des actions simplement et rapidement.

https://www.w3schools.com › js › js_loop_for.asp

JavaScript For Loop - W3Schools

JavaScript supports different kinds of loops: for - loops through a block of code a number of times. for/in - loops through the properties of an object. for/of - loops through the values of an iterable object. while - loops through a block of code while a specified condition is true.

https://stackoverflow.com › questions › 8351769

javascript - Setting variable name based on loop iteration - Stack Overflow

I have a loop in a function in Javascript that gets the coordinates and name a location from an XML file, and creates markers on a custom made google map. I want these markers to be clickable and pop up an info window. I have the code written for it, and all the markers show up fine on the map.

https://stackoverflow.com › questions › 101070

What is an ideal variable naming convention for loop variables?

1. I use "counter" or "loop" as the variable name. Modern IDEs usually do the word completion , so longer variable names are not as tedious to use. Besides , to name the variable to its functionality makes it clear to the programmer who is going to maintain your code as to what your intentions were.

https://developer.mozilla.org › en-US › docs › Learn › JavaScript › Building_blocks › Looping_code

Looping code - Learn web development | MDN - MDN Web Docs

This article has revealed to you the basic concepts behind, and different options available when looping code in JavaScript. You should now be clear on why loops are a good mechanism for dealing with repetitive code and raring to use them in your own examples!

http://devdoc.net › web › developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Loops_and_iteration.html

Loops and iteration - JavaScript | MDN - devdoc.net

Loops offer a quick and easy way to do something repeatedly. This chapter of the JavaScript Guide introduces the different iteration statements available to JavaScript.

https://www.freecodecamp.org › news › javascript-for-loops

JavaScript For Loop – Explained with Examples - freeCodeCamp.org

For Loops in JavaScript. The for loop is an iterative statement which you use to check for certain conditions and then repeatedly execute a block of code as long as those conditions are met. Flowchart for the for loop. Syntax of a for loop. for (initialExpression; condition; updateExpression) { // for loop body: statement }

JavaScript For Loop – Explained with Examples - freeCodeCamp.org

https://www.digitalocean.com › ... › for-loops-for-of-loops-and-for-in-loops-in-javascript

JavaScript For Loops - DigitalOcean

In this tutorial, we learned how to construct for loops in JavaScript, consisting of the for, for...of and for...in statements. Loops are an integral part of programming in JavaScript, and are used for automating repetitive tasks and making code more concise and efficient.