One of the biggest differences between JS and Java is that functions are also considered data and can operate like an object in Java. And because JS does not perform type checking, the array can store anything. So I wondered if the array could hold a function.
The following features are implemented:
function to store itself in an array after invocation (can not be stored according to the parameters)
You can then use a large function to manipulate the array and call the functions in it.
I would have used this method to perform a undo function (that is, each function stores itself in, and if undo eliminates the last function and executes the entire queue), then it feels too cumbersome. But the function array function is implemented: Paste JSP
Copy Code code as follows:
<%@ page language= "java" contenttype= "text/html; charset=iso-8859-1" br>pageencoding= "Iso-8859-1"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
<meta http-equiv= "Content-type" content= "text/html; charset=iso-8859-1" >
<title >MothedList</title>
<body>
<input type= "button" onclick= "ff ()"/> Br><script type= "Text/javascript" >
list = new Array;
F1 = function F1 (flage) {
Alert ("F1");
if (flage)
List.push (F1);
}
F2 = function F1 (flage) {
Alert ("F2");
if (flage)
List.push (F2);
}
Function ff () {
F1 (true);
F2 (TRUE);
F = list.pop ();
F (false);
F = list.pop ();
F ();
}
</script>
</body>