john john - 8 months ago 29
Javascript Question

How to search for a string inside an array elements using javascript?

var objTittleArr= ["Game of Thrones", "Suits", "Breaking Bad", "Legend of Korra"];

How can i find array items includes a string?

I tried to find array items includes 'orr' as below. where am I going wrong? How can i find them?

for (var j=0; j<objTittleArr.length; j++) {

if (objTittleArr[j].match(/orr/g))


Remove the j++;, it increments the loop twice each iteration, so you're skipping some elements.

Also, just in case - Legend of Korra needs to be between quotes.