12345678910111213141516171819202122 |
- (() => {
- //可选参数
- // function buildName(firstName: string = 'A',lastName?:string):string{
- // if(lastName){
- // return firstName + lastName
- // } else{
- // return firstName
- // }
- // }
- // console.log(buildName('C','D'))
- // console.log(buildName('C'))
- // console.log(buildName())
- //剩余参数
- function info(x:string,...args:string[]){
- console.log(x,args)
- }
- info('abc','a','b','c')
- })()
|