we have an array [1,2,3,4,5,6,7,8,9,0]; how to display the values ​​not randomly, but in order, remaking this function

var tempnumbers={}, tmp=''; while(regLet.test(testnumbers)){ tmp=letters[Math.floor(Math.random()*(letters.length))]; if(tempnum[tmp]!=true){ tempnum[tmp]=true; testnum=testnum.replace(regLet, tmp); 

Even I cannot fasten an iterator here, help pliz.

  • Yes, it seems to be somewhere like this. If I have a different number of digits, I can prescribe, say, newId = x * getId? what would be clearer today I will print 11,12,13, and tomorrow 111,112,113? - kot197676

1 answer 1

Strange some kind of function. if I understand you correctly, it is easier than simple http://jsfiddle.net/L9m9e/

  • @mountpoint, adjusted for the fact that javascript is special : jsfiddle.net/L9m9e/1 - etki
  • @Fike, so sure. correctly noticed) I'm already stupid. time to sleep. all good night - mountpoint
  • Thanks for the options. This type was asked on which street you live, answered-in Russia. The essence of the question is whether it is possible without reworking the whole function instead of tmp = letters [Math.floor (Math.random () * (letters.length))]; iterator function? then bish tmp = newArray for (key in newArr) etc7 - kot197676
  • @ kot197676 a) this should be in the question, because the solution outputs everything in order, b) the given code is invalid and c) I cannot understand what it does at all and what the result should be on the output. - etki
  • mm at the outlet instead of 4,6,9,1 should be 1,2,3,4. - kot197676