I am trying to pass an array value into a function as an arg and then use it's value to reference another array. I know that sounds a bit complicated but I am doing it for a reason ;) I THINK that showProject thinks that project1 is a string as it returns only 'p' and ... Any help appreciated?
var projects = ["project1","project2"];
var project1 = ["image1","image2"];
var project2 = ["image1","image2"];
function showProject(arr){
console.log(arr[0]);
}
//why isn't this showing image 1 in project 1 array?
showProject(projects[0]);
Fiddle > http://jsfiddle.net/4ryLT/
"project1"to the function which correclty alerts"p". So what is the question?project1neitherproject2are being used insideshowProject().