jQuery.isNumeric( value )

Description: 判断指定参数是否是一个数字值(字符串形式的数字也符合条件),返回 true 或者 false。

Example:

 $.isNumeric( "-10" );     // true
$.isNumeric( 16 ); // true
$.isNumeric( 0xFF ); // true
$.isNumeric( "0xFF" ); // true
$.isNumeric( "8e5" ); // true (exponential notation string)
$.isNumeric( 3.1415 ); // true
$.isNumeric( +10 ); // true
$.isNumeric( 0144 ); // true (octal integer literal)
$.isNumeric( "" ); // false
$.isNumeric({}); // false (empty object)
$.isNumeric( NaN ); // false
$.isNumeric( null ); // false
$.isNumeric( true ); // false
$.isNumeric( Infinity ); // false
$.isNumeric( undefined ); // false

JavaScript isNaN( value )

Description: 检查其参数是否是非数字值,返回 true 或者 false。

Example:

 isNaN(NaN);              // true
isNaN(undefined); // true
isNaN(null); // false 能转成0
isNaN(""); // false 能转成0
isNaN([]); // false 能转成0
isNaN({}); // true
isNaN(new Object()); // true
isNaN(new String()); // false
isNaN(new String("a")); // true
isNaN(new Array()); // false 能转成0
isNaN(new Date()); // false 能转成数字
isNaN(new Date().toString()); // true
isNaN(true); // false 能转成1
isNaN(0/0); // true

Notice:

  isNaN() 函数通常用于检测 parseFloat() 和 parseInt() 的结果,以判断它们表示的是否是合法的数字。

  isFinite() 函数用于检查其参数是否是无穷大。与 isNaN() 相反。

  

jQuery.isNumeric() 和 js isNaN()的更多相关文章

  1. 关于jQuery $.isNumeric vs. $.isNaN vs. isNaN

    在jQuery中,有几种方式可以判断一个对象是否是数字,或者可否转换为数字. 首先,jQuery.isNaN()在最新版本中已经被移除了(1.7之后),取而代之的是  jQuery.isNumeric ...

  2. jQuery $.isNumeric vs. $.isNaN vs. isNaN

    在jQuery中,有几种方式可以判断一个对象是否是数字,或者可否转换为数字. 首先,jQuery.isNaN()在最新版本中已经被移除了(1.7之后),取而代之的是  jQuery.isNumeric ...

  3. jquery.qrcode.min.js生成二维码 通过前端实现二维码生成

    主体代码: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <tit ...

  4. jQuery与原生JS相互转化

    前端发展很快,现代浏览器原生 API 已经足够好用.我们并不需要为了操作 DOM.Event 等再学习一下 jQuery 的 API.同时由于 React.Angular.Vue 等框架的流行,直接操 ...

  5. jQuery工具--jQuery.isNumeric(value)和jQuery.trim(str)

    jQuery.isNumeric(value) 概述 确定它的参数是否是一个数字. $.isNumeric() 方法检查它的参数是否代表一个数值.如果是这样,它返回 true.否则,它返回false. ...

  6. jquery.i18n.properties.js hacking

    /****************************************************************************** * jquery.i18n.proper ...

  7. 【jQuery】 实用 js

    [jQuery] 实用 js 1. int 处理 parseInt(") // int 转换 isNaN(page) // 判断是否是int类型 2. string 处理 // C# str ...

  8. jquery.nicescroll.min.js滚动条插件的用法

    1.jquery.nicescroll.min.js源码 /* jquery.nicescroll 3.6.8 InuYaksa*2015 MIT http://nicescroll.areaaper ...

  9. JQuery plugin ---- simplePagination.js API

    CSS Themes "light-theme" "dark-theme" "compact-theme" How To Use Step ...

随机推荐

  1. 微信公开课PRO版张小龙演讲全文

    今天,微信当家人张小龙通过微信官方账户发布了一则视频,视频中张小龙阐述了微信对于开放平台的一些理念和方向.张小龙用八点概括.以下是张小龙发言: 各位参加微信公开课的朋友们,大家好. 首先很遗憾这一次不 ...

  2. 30天,O2O速成攻略【7.19深圳站】

    活动概况 时间:2015年07月19日13:30-16:30 地点:深圳腾讯大厦(南山区科技园科技中一路)2楼多功能厅 主办:APICloud.OneAPM.连接科技 网址:www.apicloud. ...

  3. IIS应用程序池添加ASP.NET v4.0

    可能在安装.NET Framewrok 4.0之前,IIS就已经装好了,结果在IIS的应用程序池中只有.NET 2.0的Classic .NET AppPool和DefaultAppPool.在使用v ...

  4. iOS开发 - 网络数据安全加密(MD5)

    提交用户的隐私数据 一定要使用POST请求提交用户的隐私数据GET请求的所有参数都直接暴露在URL中请求的URL一般会记录在服务器的访问日志中服务器的访问日志是黑客攻击的重点对象之一 用户的隐私数据登 ...

  5. Xib和storyboard对比

  6. .Net Framework 4.5.2 on Windows 10

    I was using Visual Studio 2013 to create a new solution, could not select ".NET Framework 4.5.2 ...

  7. SHA-2 Certificate Signing Request

    To request an SSL certificate is now a SHA-2 Certificate Signing Request (CSR) is required. Using th ...

  8. json在action,$.ajax{}中的使用

    首先需导入包:ezmorph-1.0.4.jar Action中的调用的方法: public void getObject(){  try {   if(cname!=null&& ! ...

  9. Better PostgreSQL datacenter schema

  10. 结合DDE指标来分析成本分布的重要作用

    筹码分布集中度90和70是什么意思? (2015-08-14 12:12:27) 转载▼ 标签: 股票 分类: 成交量能.筹码分析   那个集中度90,和集中度70,90和70是什么意思??集中度最大 ...