简化js--函数返回

<script type="text/javascript">
function a(){
return false;
}
function b(){
return true;
}

function check(){
        if(a()&&b()){
        return true;
        }else{
        return false;
        }
}
</script>
<form action="http://www.cnblogs.com" onsubmit="return check()">
    <input type="submit"  value="提交"/>
</form>

上面的check函数可以简写为:

function check(){
       return a() && b() ? true :false;
}
原文地址:https://www.cnblogs.com/tinyphp/p/3394333.html