Creating An Array

Posted on 2011-10-25
Last Modified: 2013-11-24
I am trying to create an array for all the URLs on my home page.I also need to add 11 items to the array that contain quizpage0.htm through quizpage10.htm.
 Here is my code:var num = 11;
                            var adsURL = new Array(num);
                            for(var i = 0; i<adsURL.length; i++)  {
                            adsURL = "quizpage" + i + ".htm";

This is Javascript and it is telling me  the neww Array is undefined. Can u help. Thanks.
Question by:danny62
    LVL 2

    Accepted Solution

    To declare an array of a string, which you are using, you will use String[] varName;

    Here is the code snippet you want:
    int nums = 10;
    String[] arr = new Array[nums];
    for (int i = 0; i < nums; i++)
      arr[i] = "quizpage" + i + ".htm";

    Open in new window


    Author Closing Comment


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    copyEvens challenge 6 46
    Books that can get me started on JAVA 2 33
    count11 challenge 6 34
    mapShare challenge 13 41
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now