mardi 21 juin 2016

How can I call an "if includes" statement, but break as soon as the text is found?

I want to do something like this:

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

I'm working in javascript and I'm trying to speed up my project when it's ran.

Aucun commentaire:

Enregistrer un commentaire