Need Help Understanding associative Array
5 minutes ago, Sergio45 said:Yes, I want to see if blitzen was in the array,but after reading the explanation I think I don't want to go down that path.
Well- The assignment is going to be asking me to put the names of the reindeer in an array and store a count in a array and the image file in an array. So when the user types a name of the reindeer and types exit to stop the count. It shows the results of what was enter with the image associated with the character (x) many times. I was aiming to use an array like
var reindeer["rudolph"]= name,image,count(?)
and so on for each of the reindeer.
But What I think was confusing me was the structure of each array.Plus which one would work best in the case of an Associative or Multi-dimensional array.
if you change the name in my code to a reindeer then you could have all the info where I put names.
reindeer = {
"blitzen":['image.jpg', 1],
"comet":['com.jpg', 6]
};
that could work
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now