return

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        (function (a) {
            if(a==2){
                alert("a==2");
                return ;//结束函数(跳出函数)
            }
            if(a==3){
                alert("a==3");
                return ;//结束函数(跳出函数)
            }
            if(a==4){
                alert("a==4");
                return ;//结束函数(跳出函数)
            }
            alert("a不等于234会弹出这个")
        })(8)
    </script>
</body>
</html>
原文地址:https://www.cnblogs.com/huanghuali/p/9493180.html