JS 函数相关的声明调用

// 函数声明方法一
function f (a, b) {
    return a + b;
}
// 函数调用
console.log(f(1, 4)); // 5

// 函数声明方法二
var num = function(a, b) {
    return a + b;
}
console.log(num(1, 3)); // 4

// 匿函数自调用
(function () {
    alert('hello world');
})();
posted @ 2019-12-19 11:05  GetcharZp  阅读(140)  评论(0编辑  收藏  举报