troubleshooting Question

Javascript IF ELSE ARRAY

Avatar of nikdonovanau
nikdonovanau asked on
JavaScript
3 Comments1 Solution435 ViewsLast Modified:
Basically i have a script the creates the following 2 arrays. Both have bloque_id dynamically assigned. EG Bloque1 and Bloque2
for arguments sake the first array below has a bloque_id of Bloque1

window[bloque_id] = new Array();
window[bloque_id][1] = "bannanas";
window[bloque_id][2] = "oranges";

the second array below has a bloque_id of Bloque2
window[bloque_id] = new Array();
window[bloque_id][1] = "bannanas2";
window[bloque_id][2] = "oranges2";

First question is how do i make these arrays global and access them.
Second question how would i do check on their values ?  remembering that i want to access them in a different function globally if that makes sense
say also that the name of one of the arrays is stored in bloque_name as a value

if (window[bloque_name][1] == some value )
{
alert('match found');
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros