function attr(name:string):string;
function attr(age:number):string;
function attr(nameorage:any):any{
    if(nameorage &&typeof nameorage ==="string"){//代表当前是名字
        alert("ming")
    }else{
        alert("age");
    }
}
attr("hell");
attr(10);

  

相关文章:

  • 2021-09-01
  • 2021-11-30
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
猜你喜欢
  • 2021-11-14
  • 2022-12-23
  • 2022-01-10
  • 2021-08-12
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案