三、函数
1、函数的命名属性
// IE下不支持name属性var foo = function bar () { // todo };foo.name; // "bar"
2、函数的提升
function foo () { alert("global foo")}function bar () { alert("global bar")}function whoIsMe () { console.log(typeof foo); // 输出“fuction” console.log(typeof bar); // 输出“undefined” foo(); // 'local foo' bar(); // TypeError: bar is not a function // 函数声明 // 变量'foo'以及其实现者被提升 function foo() { alert("local foo"); } // 函数表达式 // 仅变量'bar'被提升 // 函数实现并未被提升 var bar = function (){ alert("local bar"); }}whoIsMe();