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. 给你完美浪漫的七夕,APICloud送你双人电影票!

    我一直觉得“幸福的感觉” 就像存款 留着以后用 会幸福感爆棚 于是,我一直习惯于等等,再等等 以为那样就会很幸福 直到有一天,突然发现,在我构想的未来中,总是有你 世界那么大,我只在乎你 世界那么长, ...

  2. python_字典

    1. 字典的定义 字典由多个键及其对应的值构成(我们也把键/值对称为项).键是唯一的,值不唯一.键可以是数字.字符串甚至是元组. 2. 字典的创建 (1) phonebook = {"} 名 ...

  3. Silverlight/WPF绘制统计图Visifire.dll文件

    官网:http://www.visifire.com/ 一直没找到好的中文文档,希望有的这个的可以发个我! 效果图: 前台代码: <UserControl x:Class="Text_ ...

  4. SEL数据类型

    // //  main.m //  06-SEL数据类型 // //  Created by apple on 14-3-18. //  Copyright (c) 2014年 apple. All ...

  5. cocos2dx 3.x以上(Sprite精灵类的相关属性与创建)

    // //  MainScene.cpp //  helloworld // //  Created by apple on 16/9/19. // // #include "MainSce ...

  6. canvas 基础知识整理(二)

    html部分: <canvas id="myCanvas" width="800" height="800" ></can ...

  7. Java基础之一组有用的类——Observable和Observer对象(Horrific)

    控制台程序. Obserable类提供了一个有趣的机制,可以把类对象中发生的改变通知给许多其他类对象. 对于可以观察的对象来说,类定义中需要使用java.util.Observable类.只需要简单地 ...

  8. mysql:sql行列转换

    今天一个同学遇到一个问题问我了,由于本人平时学习的mysql比较基础,确实没解决,后来google了一下,才知道是sql的一种技法[行列转换],话不多说先上图: 想得到下面的结果: +------+- ...

  9. #pragma message的作用

    一般情况下,#pragma message( messagestring )是在编译期间,将一个文字串(messagestring)发送到标准输出窗口.典型的使用方法是在编译时报告和显示信息.下面的代 ...

  10. 2的m次方 内存对齐

    在存储的时候,为了提高效率,一般都会让偏移量落在2的m次方的位置上,而且常有向上取整和向下取整两种需求.向下取整PALIGN_DOWN(x,align)  (x & (- align)) 这样 ...