JS判断是正数还是负数函数:
function check(x){
if(x>0){
return '正数';
}else if(x<0){
return '负数';
}else{
return 0;
}
}
示例:
![](https://www.02405.com/wp-content/uploads/2022/10/javascript-math-check.webp)
JS判断是正数还是负数函数:
function check(x){
if(x>0){
return '正数';
}else if(x<0){
return '负数';
}else{
return 0;
}
}
示例: