Skip to main content

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (stringArraystr, strArray) { for (var j=0; j<stringArrayj<strArray.length; j++) { if (stringArray[j]strArray[j].match ("height"str)) return j; } return -1; } 

Edit - make str as an argument to function.

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (stringArray) { for (var j=0; j<stringArray.length; j++) { if (stringArray[j].match ("height")) return j; } return -1; } 

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (str, strArray) { for (var j=0; j<strArray.length; j++) { if (strArray[j].match(str)) return j; } return -1; } 

Edit - make str as an argument to function.

deleted 1 characters in body; added 1 characters in body
Source Link
Aleadam
  • 40.4k
  • 9
  • 88
  • 108
added 22 characters in body
Source Link
Aleadam
  • 40.4k
  • 9
  • 88
  • 108

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (stringArray) { for (var j=0; j<stringArray.length; j++) { if (stringArray[j].match ("height")) return j; } return -1; } 

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (stringArray) { for (var j=0; j<stringArray.length; j++) { if stringArray[j].match ("height") return j; } } 

It's as simple as iterating the array and looking for the regexp

function searchStringInArray (stringArray) { for (var j=0; j<stringArray.length; j++) { if (stringArray[j].match ("height")) return j; } return -1; } 
Source Link
Aleadam
  • 40.4k
  • 9
  • 88
  • 108
Loading