1.8 JavaScript 函数

1.8 JavaScript 函数

函数是用对象来实现的。
函数也C++中的函数类似。

定义方式:

function add(a, b) {
    
    
    return a + b;
}

let add = function (a, b) {
    
    
    return a + b;
}

let add = (a, b) => {
    
    
    return a + b;
}

返回值:

如果未定义返回值,则返回undefined。

猜你喜欢

转载自blog.csdn.net/qq_42465670/article/details/130397218
1.8
今日推荐