xataku_nakusute
07-28-2003, 08:32 PM
how would you make a statement thatll increment some value by going through an array?
|
Click to See Complete Forum and Search --> : increment by array value xataku_nakusute 07-28-2003, 08:32 PM how would you make a statement thatll increment some value by going through an array? pyro 07-28-2003, 09:13 PM Please explain what you are asking better... xataku_nakusute 07-28-2003, 09:19 PM say i had a number of some type, and i wanted to increment it by different value each time(the increment value being different values in an array).....soo.....ummm...yeah.... so like......my array has like.... array[0] = 1 array[1] = 15; etc etc... and then incrememnt my value by the array values xataku_nakusute 07-28-2003, 09:21 PM that prolly doesnt help, huh? pyro 07-28-2003, 09:26 PM Something like this, then? <script type="text/javascript"> x = 5; array = new Array("1","5","10"); x = x + Number(array[1]); alert (x); </script> Charles 07-29-2003, 03:41 AM <script type="text/javascript"> <!-- Array.prototype.next = function () {if (isNaN(this.n) || this.n >= this.length) this.n = 0; return this[this.n++]}; increment = [1, 2, 3, 4, 5, 6, 7, 8, 9]; n = 0; for (i=0; i<=increment.length; i++) {document.write(n += increment.next(), '<br>')} // --> </script> xataku_nakusute 07-29-2003, 03:45 AM thank you both! webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |