Set type for function parameters?

后端 未结 12 1842
醉话见心
醉话见心 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:15

    It can easilly be done with ArgueJS:

    function myFunction ()
    {
      arguments = __({myDate: Date, myString: String});
      // do stuff
    };
    

提交回复
热议问题