本文介绍了isNaN()函数在javascript中有多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以在javascript中检查isNaN函数中的多个值吗?
喜欢这个,
Can check more than one values in isNaN function in javascript?like this,
if(isNaN(tesvalue1,testvalue2,testvalue3)) {
//alert( );
}
推荐答案
我想你在这里之后:
如果你想测试所有的值是NaN那么使用&&运算符:
If you want to test all of the value is NaN then use && operator:
if(isNaN(tesvalue1) && isNaN(testvalue2) && isNaN(testvalue3)) {
//alert( );
}
如果要测试NaN的任何值,请使用||运算符:
If you want to test any of the value is NaN then use || operator:
if(isNaN(tesvalue1) || isNaN(testvalue2) || isNaN(testvalue3)) {
//alert( );
}
或者,如果你想要组合(添加)所有值并测试它是否是NaN:
Or, if you want to combine(add) all values and test if it is NaN:
if(isNaN(tesvalue1+testvalue2+testvalue3)) {
//alert( );
}
这篇关于isNaN()函数在javascript中有多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!