how to pass in a reference to a string in javascript?
Posted
by ijjo
on Stack Overflow
See other posts from Stack Overflow
or by ijjo
Published on 2010-05-18T17:36:05Z
Indexed on
2010/05/18
17:40 UTC
Read the original article
Hit count: 199
maybe a closure is my solution? not exactly sure how to pull it off though.
the code is set up like so:
var globalVar = '';
var globalVar2 = '';
function func()
{
if (condition)
func2(globalVar)
else
func2(globalVar2)
}
in func2() i cache some HTML in a main container into the appropriate global variable that i pass to it. basically i have a main container that holds different pages depending on what tab they choose. for performance i want to cache the page into global vars so i need to know what tab is active to figure out which global var to assign the html to.
© Stack Overflow or respective owner