如何拨打"如果包含"声明,但一旦发现文本就会中断?

时间:2016-06-21 15:46:00

标签: javascript if-statement search break

我想做这样的事情:

var x = "";
if (string.includes("hello")) {
     stop searching as soon as "hello" is found
     x += string; 
}

我在javascript工作,我试图在项目运行时加快我的项目。

0 个答案:

没有答案