Because JavaScript functions cannot be passed through as expected, multiple values are sometimes returned.Code:
Reference: http://blog.csdn.net/leftfist/archive/2008/04/09/2269415.aspx
<HTML>
<Body>
<SCRIPT>
Function f (S1, man)
{
S1 = "Byebye ";
Man = new object ();
Man. Name = "yzx ";
Return [S1, Man];
}
S1 = "hello ";
Man = new object ();
Man. Name = "name ";
Man. Age = 30;
VaR ret = f (S1, man );
S1 = RET [0];
Man = RET [1];
Alert ("S1 =" + S1 );
Alert ("man. Name =" + man. Name );
Alert ("man. Age =" + man. Age );
</SCRIPT>
</Body>
</Html>
Sometimes 1st values are used in the return value, which can be written as follows:
S1 = f (S1, man) [0];
In addition, the return value can also be in the form of named parameters:
Return {_ S1: S1, _ Man: Man };
In this way, the return value is used:
VaR ret = f (S1, man );
S1 = ret. _ S1;
The previous one returns the result in the form of an array (RET has the Length attribute), and the next one returns the result in the form of an object.