Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-22-2011, 02:04 AM   PM User | #1
dpete
New Coder

 
Join Date: Sep 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
dpete is an unknown quantity at this point
Very new to javascript, question..

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.
dpete is offline   Reply With Quote
Old 09-22-2011, 03:00 AM   PM User | #2
Desmondowq
New to the CF scene

 
Join Date: Sep 2011
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Desmondowq is an unknown quantity at this point
ok hint, you need to restart something back to 0 after incremented it
Desmondowq is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Advertisement
Log in to turn off these ads.