?
Solved

Creating An Array

Posted on 2011-10-25
2
Medium Priority
?
319 Views
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.
0
Comment
Question by:danny62
2 Comments
 
LVL 2

Accepted Solution

by:
agerbert earned 2000 total points
ID: 37041474
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

0
 

Author Closing Comment

by:danny62
ID: 37043755
Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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