Javascript array problem
var Dogs = new Array();
Dogs[0] = "Raven";
Dogs[1] = "Arek";
Dogs[2] = "Demo";
Dogs[3] = "Haley";
// Images = number of images
var Images = new Array();
Images[0] = 5;
Images[1] = 7;
Images[2] = 8;
Images[3] = 4;
function initDog(dog) {
if(dog === "") { dog='Raven'; }
imgSetNum = Dogs.indexOf(dog);
imgMax = Images[imgSetNum];
imgSetNum ++;
}
in the function initDog, imgSetNum = Dogs.indexOf(dog) always return -1 (not found). I verified that the "dog" value is correctly set to a dog name in the Dogs array.
What am I doing wrong?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks