You can use Array.prototype.find function in javascript. Array find MDN.
So to find string in array of string, the code becomes very simple. Plus as browser implementation, it will provide good performance.
Ex.
var strs = ['abc', 'def', 'ghi', 'jkl', 'mno']; var value = 'abc'; strs.find( function(str) { return str == value; } ); or using lambda expression it will become much shorter
var strs = ['abc', 'def', 'ghi', 'jkl', 'mno']; var value = 'abc'; strs.find((str) => str === value);