You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Maybe I'm misunderstanding... Math.wrap will return a number between 0 and 9, even though at line 80 in the code above, k itself will be somewhere around 40.

    In your uploaded code:

      for(var j = 0; j < 30; j++) {
        tmp[i] = i;
        console.log('k = ' + k +'  ' + 'i = ' + i);
        Math.wrap(k++, 10);
        i++; if(i > 9) {i = 0;}
      }
    

    The return value of Math.wrap isn't being used, so you might as well be doing:

      for(var j = 0; j < 30; j++) {
        tmp[i] = i;
        console.log('k = ' + k +'  ' + 'i = ' + i);
        k++;
        i++; if(i > 9) {i = 0;}
      }
    
About

Avatar for Gordon @Gordon started