Set type for function parameters?

后端 未结 12 1827
醉话见心
醉话见心 2020-11-30 18:37

Is there a way to let a javascript function know that a certain parameter is of a certain type?

Being able to do something like this would be perfect:



        
12条回答
  •  隐瞒了意图╮
    2020-11-30 19:04

    No, JavaScript is not a statically typed language. Sometimes you may need to manually check types of parameters in your function body.

提交回复
热议问题