...

View Full Version : Very new to javascript, question..



dpete
09-22-2011, 03:04 AM
I'm not really looking for someone to fix/answer this for me, but maybe give me a hit in the right direction. I need to fix this while loop to run correctly, but has errors in the code. This code is supposed to fill an array with numbers 1 through 100 and then print them.

Here is the code:

<script type="text/javascript">
/* <![CDATA[ */

var count = 0;
var numbers = new Array(100);

while (count < 100) {
numbers[count] = count;
++count;

}

while (count < 100 ) {
document.write(numbers[count]);
++count;
}
/* ]]> */
</script>

What i am most confused about is this part of the code numbers[count] i don't understand what is going on there. Sorry i am very new to this.

Any ideas would be appreciated
thank you.

Desmondowq
09-22-2011, 04:00 AM
ok hint, you need to restart something back to 0 after incremented it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum