typeof:在 Javascript 中检查类型的更好方法

时间:2021-06-11 15:09:30
【文件属性】:
文件名称:typeof:在 Javascript 中检查类型的更好方法
文件大小:1KB
文件格式:ZIP
更新时间:2021-06-11 15:09:30
JavaScript 类型 在 Javascript 中检查类型的更好方法有关为什么类型有时会很糟糕的更多信息,请访问此博客 例子 var foo = [ ] // create a new array foo . typeof ( "array" , function ( ) { //this matches an array lets do something with it. } ) foo . typeof ( "string" , function ( ) { //this doesn't match so it won't do anything but if it does detect a string instead of an array you can throw an error } ) foo . typeof ( ) // array
【文件预览】:
typeof-master
----typeof.js(675B)
----readme.md(577B)

网友评论