javascript通用参数判断
2020-11-24 05:52
标签:java javascript int cti type value ber val script efi return //判断value是小于等于max的数字 //判断value是大于等于min的数字 function isNumberMin(value, min){ //判断value是否是数字 function isNumber(value) { console.log(1,isNumber(111)); console.log(2,isNumber("111")); console.log(3,isNumber(0)); console.log(4,isNumber("0")); console.log(5,isNumber(null)); console.log(6,isNumber({})); console.log(7,isNumber("ssdsd")); console.log(8,isNumber(undefined)); console.log(9,isNumber()); console.log(10,isNumber("")); console.log(11,isNumber("-1")); console.log(12,isNumberMin(1,"-1")); console.log(13,isNumberMax(1,9)); javascript通用参数判断,搜素材,soscw.com javascript通用参数判断 标签:java javascript int cti type value ber val script efi return 原文地址:http://www.cnblogs.com/ajun/p/3701596.html
function isNumberMax(value,
max){
if(!isNumber(value) ||
!isNumber(max)){
return
false;
}
if(parseInt(value) return
true;
}
return false;
}
if(!isNumber(value)
|| !isNumber(min)){
return
false;
}
if(parseInt(value) >=
min){
return
true;
}
return false;
};
if(value === "" || value ===
null)
return
false;
if (typeof value === ‘number‘)
{
return
true;
};
return
!isNaN(value);
};
上一篇:C++的那些事:函数全解析