/* 函数的定义 */
function a() { return 1; }

var b = function () { return 1; };

var c = function d() { return 1; }; // d === undefined

var e = new Function("return 1;");

alert(typeof a); //function
alert(typeof b); //function
alert(typeof c); //function
alert(typeof d); //undefined
alert(typeof e); //function

alert(a() + b() + c() + e()); //4


/* 函数自执行 */
(function (a, b) { alert(a + b); }) (1, 2);        //3

(function (a, b) { alert(a + b); } (1, 2));        //3

var f = function (a, b) { alert(a + b); } (1, 2);  //3; f === undefined

posted on 2012-03-15 18:13  万一  阅读(1384)  评论(3编辑  收藏  举报