jQuery.isNumeric()方法
jQuery 教程
· 2019-03-28 21:56:35
实例
判断输入值类型
$(function () {
function fun( html ){
document.body.innerHTML += "<br>" + html;
}
// true
fun($.isNumeric( "-10" ));
fun($.isNumeric( "0" ));
fun($.isNumeric( 0xFF ));
fun($.isNumeric( "0xFF" ));
fun($.isNumeric( "8e5" ));
fun($.isNumeric( "3.1415" ));
fun($.isNumeric( +10 ));
fun($.isNumeric( 0144 ));
//false
fun($.isNumeric( "-0x42" ));
fun($.isNumeric( "7.2acdgs" ));
fun($.isNumeric( "" ));
fun($.isNumeric( {} ));
fun($.isNumeric( NaN ));
fun($.isNumeric( null ));
fun($.isNumeric( true ));
fun($.isNumeric( Infinity ));
fun($.isNumeric( undefined ));
})
定义和用法
$.isNumeric() 函数用于判断指定参数是否是一个数字值。
注意:在jQuery 3.0中,$.isNumeric()方法只有接收number类型的参数,或者是可以被强制为有限数值的 string类型的参数时,才会返回true,否则返回false。
语法
$.isNumeric( value )
| 参数 | 描述 |
|---|---|
| value | 任意类型 需要进行判断的任意值。 |
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
Rust编程之道
张汉东 / 电子工业出版社 / 2019-1 / 128
Rust 是一门利用现代化的类型系统,有机地融合了内存管理、所有权语义和混合编程范式的编程语言。它不仅能科学地保证程序的正确性,还能保证内存安全和线程安全。同时,还有能与C/C++语言媲美的性能,以及能和动态语言媲美的开发效率。 《Rust编程之道》并非对语法内容进行简单罗列讲解,而是从四个维度深入全面且通透地介绍了Rust 语言。从设计哲学出发,探索Rust 语言的内在一致性;从源码分析入......一起来看看 《Rust编程之道》 这本书的介绍吧!