<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Function Learning </title>
<script type= "Text/javascript" >
/*show ("Zhang San", 22);
Function Show (name,age) {
Alert ("Name:" +name+ "Age:" +age);
}
(function (name,age) {
Alert ("Name:" +name+ "Age:" +age);
})
("Zhang San", 22);
var f=function (name,age) {
Alert ("Name:" +name+ "Age:" +age);
}
F ("Zhang San", 12); */
/*var f=new Function ("name", "Age", "alert (' Name: ' +name+ ' ages: ' +age)");
*//*f ("Zhang San", 23);
Alert (f instanceof Function); *//*
WINDOW.F ("Zhang San", 10); */
/* Function Show () {
return function () {
Alert ("Sasds");
};
}
var f=show ();
f (); */
/*var name= "Chenghao";//global variable
Function Show () {
var name= "Zhangsan"
var age=10;//local Variables
Alert ("Name:" +name+ "Age:" +age);
}
Show ();
*//*
Function F1 () {
var name= "Limeilan";
function F2 () {
var age=23;
alert (name,age);
}
F2 ();
}
F1 (); */
The concept of closures
/* Function F3 () {
var n=1;
function F4 () {
alert (n);
}
return f4;
}
var f=f3 ();
f (); */
Function Show (name,age) {
Alert ("Name:" +name+ "Age:" +age);
}
Window.show ("Zhang San", 22);
Show.call (window, "Zhang San", 10);
Show.apply (window,["Zhang San", 11]);
Function Show (Arr,func) {
Func.call (Window,arr);
}
Show ([1,2,3,4],function (arr) {
For (i in arr) {
document.write (arr[i]+ "<br/>");
}
});
</script>
<body>
</body>
Instead of the memory in the computer, it is better to take out to help a group of small white HTML one