命名函数
function say(name) {
console.log(name);
}
匿名函数
let say = function (name) {
console.log(name);
}
箭头函数
let say = (name) => {
console.log(name);
}
TS 当中的写法
命名函数
function say(name: string): void {
console.log(name);
}
匿名函数
let say = function (name: string): void {
console.log(name);
}
箭头函数
let say = (name: string): void => {
console.log(name);
}
|
请发表评论