//函数声明 function area(width,height){ return width*height; } var size = area(3,4);
//函数表达式,函数存储于变量area中,可以像调用在函数声明中创建的函数一样调用 var area = function(){ var width = 2; var height =3; return width*height; }; var size = area(3,4);
//立即调用函数表达式,area变量存储的是从这个函数返回的结果 var area = function(){ var width = 2; var height =3; return width*height; }();