Jump to content

[SOLVED] Passing variables between functions


jellis

Recommended Posts

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.