First way is
function function1()
{
var variable1=12;
function2(variable1);
}
function function2(val)
{
var variableOfFunction1 = val;
// Then you will have to use this function for the variable1 so it doesn't really help much unless that's what you want to do. }
Second way is
var globalVariable;
function function1()
{
globalVariable=12;
function2();
}
function function2()
{
var local = globalVariable;
}