如何记住tempValue
之外的变量if
,将其作为其他功能的参数?因为它返回零...
function rememberFirstOperand()
{
var rep1 = /[/|*|+|-]/;
var rep2 = /[0-9](?=[*|/|+|-])/;
var tempValue=0;
if (rep1.test(calculator.answer.value))
{
tempValue=calculator.answer.value;
calculator.answer.value='';
}
return tempValue;
}