javascript中全局对象的isNaN()方法使用介绍

时间:2013-12-19    点击:98   

复制代码 代码如下:

<html>
<head>
<title>全局对象的isNaN()方法</title>
<script>
/*
isNaN() 函数通常用于检测 parseFloat() 和 parseInt() 的结果,以判断它们表示的是否是合法的数字。
当然也可以用 isNaN() 函数来检测算数错误,比如用 0 作除数的情况。
*/
document.write(isNaN(123) + "<br/>");//false
document.write(isNaN(-1.23) + "<br/>");//false
document.write(isNaN(5-2) + "<br/>");//false
document.write(isNaN(0) + "<br/>");//false
document.write(isNaN("Hello") + "<br/>");//true
document.write(isNaN("2005/12/12")+ "<br/>");//true
</script>
</head>
<body>
<div id="time"></div>
</body>
</html>

js获取select选中的option的text示例代码
js 高效去除数组重复元素示例代码
javascript中字符串的定义示例代码
javascript中typeof的使用示例
javascript中普通函数的使用介绍
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved