jellis Posted October 18, 2007 Share Posted October 18, 2007 Hi all, Reasonably urgent matter (assignment is due in about an hour ???) I'm attempting to pass an array in a function call which is being called from within another function... like so function foo(f){ array[0] = joe; array[1] = smith; // Call new function and pass array newWindow.call(array); } // End define function function newWindow(array){ // Do stuff with array } I've spent the last couple of hours googling the problem... however, it appears I just do not understand the way javascript works... I've tried declaring the array outside of the functions... but no joy. Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/73730-solved-passing-variables-between-functions/ Share on other sites More sharing options...
jellis Posted October 18, 2007 Author Share Posted October 18, 2007 For those that cared (and for future reference)... I'm a twit! It was simply a case of calling the new function and passing the argument in the function call... as you would do with any other function call. Turned out I had a clash with some variable names versus input id's that was causing the script to just halt. Luckily the teacher sorted the stuff out before I handed it in. Link to comment https://forums.phpfreaks.com/topic/73730-solved-passing-variables-between-functions/#findComment-372258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.