jQuery.type()方法

jQuery 教程 · 2019-03-29 11:38:50

实例

该参数是否一个正则表达式

这是一个正则表达式? <b></b> <script> $(function () { $( "b" ).append( "" + jQuery.type( /test/ ) ); }) </script>

定义和用法

$.type() 函数用于确定JavaScript内置对象的类型,并返回小写形式的类型名称。

如果对象是undefined或null,则返回相应的"undefined"或"null"

$.type( undefined ) === "undefined"

$.type() === "undefined"

$.type( window.notDefined ) === "undefined"

$.type( null ) === "null"

如果对象有一个内部属性[[Class]]和一个浏览器的内置对象的 [[Class]] 相同,我们返回相应的 [[Class]] 名字。

$.type( true ) === "boolean"

$.type( 3 ) === "number"

$.type( "test" ) === "string"

$.type( function(){} ) === "function"

$.type( [] ) === "array"

$.type( new Date() ) === "date"

$.type( new Error() ) === "error" // jQuery 1.9 新增支持

$.type( /test/ ) === "regexp"

语法

$.type( obj )

参数 描述
obj 任意类型 需要确定类型的任意对象。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

创新者的窘境

创新者的窘境

克莱顿•克里斯坦森( Clayton M. Christensen ) / 胡建桥 / 中信出版社 / 2010-6 / 38.00元

管理类经典图书 o 被《福布斯》评为20世纪最具影响的20本商业图书之一 o “全球商业书籍奖”获奖图书 “颠覆大师”克莱顿•克里斯坦森经典力作。 《金融时报》/布兹•亚兰及汉密顿全球商务书刊颁发“1997年最佳商务书”奖 “1997年最佳商务‘实用’书”奖 一本书, 让志在必得者战战兢兢, 让犹豫不前者胸有成竹, 掀起激荡决策者的脑力风暴, ......一起来看看 《创新者的窘境》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具