I want to check if a string is equal to one of many other strings, e.g.
const str = "foo";
if (["foo", "bar", "bar"].contains(str)) {
// Do something
} else if (["abc", "def", "ghi"].contains(str)) {
// Do something else
} // and so on
Is there a simple way to do this without having to declare these multiple arrays of strings up front?
I was considering a for loop over an inline array of strings, but am not sure of the syntax.