js generate list of names with forloop code example
Example 1: dynamic loop variable .each create hash javascript
for (var i = 0; i < coords.length; ++i) {
this["marker"+i] = "some stuff";
}
Example 2: js generate list of names with forloop
function amppari() {
var text = "";
var text1 = "";
var text2 = "";
var text3="";
var text4= "";
var text5= "";
var possible = "abcdefghijklmnopqrstuvwxyzöä";
for (var i = 0; i < 6; i++){
text += possible.charAt(Math.floor(Math.random() * possible.length));
text1 += possible.charAt(Math.floor(Math.random() * possible.length));
text2 += possible.charAt(Math.floor(Math.random() * possible.length));
text3 += possible.charAt(Math.floor(Math.random() * possible.length));
text4 += possible.charAt(Math.floor(Math.random() * possible.length));
text5 += possible.charAt(Math.floor(Math.random() * possible.length));
}
console.log(text+"\t"+text1+"\n"+text2+"\t"+text3+"\n"+text4+"\t"+text5+"\t");
}
amppari();
//results in console:
//wqdwxe unmokä
//iuqckn roloäk
//istqtu äuäayi
//;)