专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Javascript教程 » javascripttypeof:Javascript typeof 使用方法 »正文

javascripttypeof:Javascript typeof 使用方法

来源: 发布时间:星期一, 2008年12月29日 浏览:2次 评论:0
(document.mylist.length != "und" ) {} 这个使用方法有误.
正确( typeof(document.mylist.length) != "und" ) {}
( !isNaN(document.mylist.length) ) {}
typeof运算数未定义,返回就是 "und".
运算数为数字 typeof(x) = "number"
串 typeof(x) = ""
布尔值 typeof(x) = "boolean"
对象,和null typeof(x) = "object"
typeof(x) = "function"
typeof 运算符返回个用来表示表达式数据类型
可能串有:"number"、""、"boolean"、"object"、"function" 和 "und"
如:
alert(typeof (123));//typeof(123)返回"number"
alert(typeof ("123"));//typeof("123")返回""
typeof 运算符
返回个用来表示表达式数据类型
typeof[expression] ;
expression 参数是需要查找类型信息任意表达式
脚本的家 www.jb51.net 更多javascript资料可以访问
介绍说明
typeof 运算符把类型信息当作串返回typeof 返回值有 6种可能: "number," "," "boolean," "object," "function," 和 "und."
typeof 语法中圆括号是可选项

相关文章

读者评论

  • 共0条 分0页

发表评论

  • 昵称:
  • 内容: