Answers for "search in string array javascript"


search in string array javascript

function searchStringInArray (str, strArray) {
    for (var j=0; j<strArray.length; j++) {
        if (strArray[j].match(str)) return j;
    return -1;
Posted by: Guest on April-08-2021

find string in array javascript

var myarr = ["I", "like", "turtles"];
var arraycontainsturtles = (myarr.indexOf("turtles") > -1);
Posted by: Guest on September-23-2020

Code answers related to "search in string array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language