如何早日打破功能? [英] How to break from function early?

查看:53
本文介绍了如何早日打破功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在JavaScript中破坏此功能?我不是JS程序员,但我需要在JS中做一些事情,而我却无法找到解决方案。如果你想把我链接到一个有这个解决方案的好手册,那就可以了。



我的尝试:



  function  foo(){
// code
if // thing){
break ;
}
// 代码
}

解决方案

 function foo(){
// code
if(// thing){
返回;
}
//代码
}


我们称之为返回 [ ^ ]。


这是一个很好的JS和其他网络语言和技术的教程网站。

JavaScript教程 [ ^ ]

How do I break this function in JavaScript? I'm not a JS programmer, but I needed to do something in JS, and I'm having trouble finding the solution to this. If you want to link me to a good manual that has this solution, that works to.

What I have tried:

function foo(){
    //code
    if(//thing){
        break;
    }
    //code
}

解决方案

function foo(){
    //code
    if(//thing){
        return;
    }
    //code
}


We call it return[^].


Here is a good tutorial site for JS and other web languages and techniques.
JavaScript Tutorial[^]


这篇关于如何早日打破功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆