Just make a little helper function that does what you said, loops through the array and checks each value. An efficient way to do that is with Array.some, as it will return true as soon as it finds a truthy match.

let validSLDs = ['hulu','netflix']

let string1 = 'www.hulu.com/watch/...';
let string2 = 'http://www.netflix.com/watch/...';
let string3 = 'imdb.com/title/....'

const isURLOK = (testString) => validSLDs.some(v => testString.indexOf(v) > -1);

console.log(isURLOK(string1));
console.log(isURLOK(string2));
console.log(isURLOK(string3));

Answer from James on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › indexOf
Array.prototype.indexOf() - JavaScript | MDN
const beasts = ["ant", "bison", "camel", "duck", "bison"]; console.log(beasts.indexOf("bison")); // Expected output: 1 // Start from index 2 console.log(beasts.indexOf("bison", 2)); // Expected output: 4 console.log(beasts.indexOf("giraffe")); // Expected output: -1 ... Element to locate in the array. ... Zero-based index at which to start searching, converted to an integer. Negative index counts back from the end of the array — if -array.length <= fromIndex < 0, fromIndex + array.length is used.
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-indexof
Exploring the indexOf Method for Strings and Arrays in JavaScript | DigitalOcean
December 17, 2019 - Lookout here comes 🐊!" const spencersIndex = whereIsSpencer.indexOf('Spencer'); // spencersIndex === 23 // to find find the second occurence of 'Spencer', // we need to add one to the position of spencer #1 const secondSpencerIndex = whereIsSpencer.indexOf('Spencer', spencersIndex + 1); // secondSpencerIndex === 46 const alligatorIndex = whereIsSpencer.indexOf('🐊'); // alligatorIndex === 91 // Be careful the search is case sensitive! const lowerCaseSpencer = whereIsSpencer.indexOf('spencer'); // lowerCaseSpencer === -1 · Now we can create the same indicesOf function for Array.prototype.string.
🌐
W3Schools
w3schools.com › jsref › jsref_indexof_array.asp
JavaScript Array indexOf() Method
The indexOf() method starts at a specified index and searches from left to right (from the given start postion to the end of the array).
🌐
Tabnine
tabnine.com › home › how to use the indexof method in javascript
How to Use the indexOf method in JavaScript - Tabnine
July 25, 2024 - As array indices begin at zero, the value 0 is returned. The below example demonstrates how to use indexOf() with a string: const str = 'How much wood would a woodchuck chuck'; console.log(str.indexOf('wood')); // Expected output: 9 · The code sample above searches the sentence stored in const str for the term wood. The first appearance of this term begins at index 9, despite there being two occurrences of the term “wood” in the string, and thus the value 9 is returned.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › indexOf
String.prototype.indexOf() - JavaScript | MDN
The method returns the index of the first occurrence of the specified substring at a position greater than or equal to position, which defaults to 0. If position is greater than the length of the calling string, the method doesn't search the calling string at all.
🌐
Programiz
programiz.com › javascript › library › array › indexof
JavaScript Array indexOf()
Note: indexOf() compares searchElement to elements of the Array using strict equality (similar to triple-equals operator or ===). var priceList = [10, 8, 2, 31, 10, 1, 65]; // indexOf() returns the first occurance · var index1 = priceList.indexOf(31); console.log(index1); // 3
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript array methods › array.prototype.indexof()
JavaScript Array indexOf() Method
November 6, 2024 - Summary: in this tutorial, you will learn how to use JavaScript Array indexOf() method to find the index of the first matching element in an array
Find elsewhere
🌐
Mimo
mimo.org › glossary › javascript › array-indexof-method
JavaScript Array indexOf() method: Syntax, Usage, and Examples
The indexOf() method lets you search an array for a specific value and returns its first index. If the value isn’t found, it returns -1. The JavaScript array indexOf method is a quick and reliable way to determine the position of an element in an array, especially when working with primitive ...
🌐
MSR
rajamsr.com › home › javascript indexof(): the best way to search arrays and strings
JavaScript IndexOf(): The Best Way to Search Arrays and Strings | MSR - Web Dev Simplified
March 12, 2024 - Are looking to check whether a value exists in a string or array? you can use the JavaScript indexOf() method. The index of the first occurrence will be returned for the specified value in a string or array.
🌐
Medium
medium.com › front-end-weekly › the-difference-between-indexof-and-findindex-in-javascript-a2035639dce5
The Difference Between indexOf and findIndex in JavaScript | by Sumit kumar Singh | Frontend Weekly | Medium
June 8, 2023 - For arrays: array.indexOf(searchElement, fromIndex) For strings: string.indexOf(searchValue, fromIndex) ... fromIndex (optional): The index to start searching from. If not specified, the search starts from index 0. The indexOf method returns ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-array-indexof-method
JavaScript Array indexOf() Method | GeeksforGeeks
September 27, 2024 - This code demonstrates the use of the indexOf() method to find the index of a specific element (2) in an array (A). It returns the index of the first occurrence of the element in the array (1 in this case).
🌐
W3Schools
w3schools.com › jsref › jsref_indexof.asp
JavaScript String indexOf() Method
The indexOf() method returns the position of the first occurrence of a value in a string.
🌐
ZetCode
zetcode.com › js-array › indexof
JavaScript indexOf - finding elements in JS
The loop starts searching from the position after the last found index. Each found position is added to the indices array. This technique works for both arrays and strings. ... In this article we have demonstrated how to use the indexOf() method to find elements in JavaScript arrays and strings.
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript array indexof method
JavaScript Array indexOf Method Explained
September 1, 2008 - The JavaScript Array indexOf() method is used to return the first occurrence index of a specified element within an array (if it is present at least once).
🌐
Poly Code
polycode.tech › home › javascript › javascript indexof explained: how to find positions in strings and arrays
JavaScript indexOf Explained: How to Find Positions in Strings and Arrays - PolyCode
December 5, 2025 - Ultimately, these basics offer a foundation not only for programming but also for logical thinking and problem-solving skills. Combine javascript string contains with `indexOf` for more semantic clarity—although `includes()` can replace some patterns, `indexOf` is useful when index positions matter. For searching within arrays, consider using `findIndex()` if you want more complex conditional checks over `indexOf`.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › TypedArray › indexOf
TypedArray.prototype.indexOf() - JavaScript | MDN
const uint8 = new Uint8Array([10, 20, 30, 40, 50]); console.log(uint8.indexOf(50)); // Expected output: 4 // From position 3 console.log(uint8.indexOf(20, 3)); // Expected output: -1 console.log(uint8.indexOf(51)); // Expected output: -1 ... Element to locate in the typed array. ... Zero-based index at which to start searching, converted to an integer. The first index of searchElement in the typed array; -1 if not found.
🌐
Career Karma
careerkarma.com › blog › javascript › javascript indexof: a step-by-step guide
JavaScript indexOf: A Step-By-Step Guide | Career Karma
December 1, 2023 - The JavaScript indexOf method allows programmers to find out whether a string or array contains a value, and returns the index number at which that value starts. Learn about how to use the indexOf method on Career Karma.
🌐
CoreUI
coreui.io › answers › how-to-find-the-index-of-an-element-in-an-array-in-javascript
How to find the index of an element in an array in JavaScript · CoreUI
September 19, 2025 - The indexOf() method searches the array from the beginning and returns the index of the first occurrence of the specified element, or -1 if the element is not found. In this example, fruits.indexOf('banana') returns 1 because ‘banana’ first ...