Link to home
Start Free TrialLog in
Avatar of nikdonovanau
nikdonovanau

asked on

Javascript IF ELSE ARRAY

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');
}
ASKER CERTIFIED SOLUTION
Avatar of Jose_Jayan
Jose_Jayan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nikdonovanau
nikdonovanau

ASKER

Thanks guys for that. A+