Ext.isNumber与Ext.isNumeric

Ext.isNumber:

 1 Ext.isNumber(1)
 2 true
 3 Ext.isNumber(new Number(1))
 4 false
 5 Ext.isNumber("1")
 6 false
 7 
 8 Ext.isNumber(Number.MAX_VALUE)
 9 true
10 Ext.isNumber(Number.MIN_VALUE)
11 true
12 
13 Ext.isNumber(Number.POSITIVE_INFINITY)
14 false
15 Ext.isNumber(Number.NEGATIVE_INFINITY)
16 false

Ext.isNumeric:

 1 Ext.isNumeric(1)
 2 true
 3 Ext.isNumeric(new Number(1))
 4 true
 5 Ext.isNumeric("1")
 6 true
 7 
 8 Ext.isNumeric(Number.MAX_VALUE)
 9 true
10 Ext.isNumeric(Number.MIN_VALUE)
11 true
12 
13 Ext.isNumeric(Number.POSITIVE_INFINITY)
14 false
15 Ext.isNumeric(Number.NEGATIVE_INFINITY)
16 false

区别在于:

对于数字对象、数字字符串

Ext.isNumber返回false;而Ext.isNumeric返回true

posted @ 2019-04-22 17:07  松松敲代码  阅读(439)  评论(0编辑  收藏  举报