Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post
    ok hint, you need to restart something back to 0 after incremented it


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •