Let’s compare .some(), .includes(), and .findIndex() to see why .some() is the best choice in this case.
Why Not .includes()?
How .includes() Works
.includes(value) only works for exact matches in an array.
It checks if the array contains the exact string or number.
Why It Won’t Work Here
Your case needs partial matching (window.location.hostname.includes(host)), but .includes() only checks for exact matches.
🔴 Example: Doesn't Work for Partial Matching
const hosts = ["localhost", "127.0.0.1"];
const isLocal = hosts.includes(window.location.hostname);
console.log(isLocal);
❌ This only works if window.location.hostname is exactly "localhost" or "127.0.0.1", but it fails if the hostname is "localhost:4200" (which is common in Angular development).
