js 中if else if这个是不是可以包夹很多个的?Add an else if branch to your existing if/else statement.If thenumber put into the function is not a number at all,instead of returntrue; or return false;,the function should return a string tha
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 14:34:27
js 中if else if这个是不是可以包夹很多个的?Add an else if branch to your existing if/else statement.If thenumber put into the function is not a number at all,instead of returntrue; or return false;,the function should return a string tha
js 中if else if
这个是不是可以包夹很多个的?
Add an else if branch to your existing if/else statement.If thenumber put into the function is not a number at all,instead of returntrue; or return false;,the function should return a string that tells the user that their input isn't a number.(This string can say whatever you like.)
------------------------------------------代码-----------------------
var isEven = function(number) {
if(number % 2 ==0){
return true ;}
else{
return false;}
}
else if(isNaN(isEven)){
return "ok,go on"}
else{
return "please input a number"}
-------------------------------问题-------------------------------
靠,这个,妈蛋的我知道知道这个是错的肯定是错的,系统叫我弄额ELSE IF的结构,神经,我就是不会弄,我就掉在这个坑了,其他的估计没有错.
js 中if else if这个是不是可以包夹很多个的?Add an else if branch to your existing if/else statement.If thenumber put into the function is not a number at all,instead of returntrue; or return false;,the function should return a string tha
var isEven = function(number) {
if(!isNaN(parseFloat(number)) && isFinite(number)){
return "ok, go on !";
} else {
return "please input a number";
}
}
or
var isEven = function(number) {
if(number - parseFloat(number) >= 0){
return "ok, go on !";
} else {
return "please input a number";
}
}