If String is in List Then...

Hi, is there anyway to accomplish something like this pseudo?

if (myString == myList){
    //Do something...
}

Basically, what i have done is i have created a textbox, and when
a player enters a string into the textbox, the next level will load.
BUT, the next level will ONLY load IF the string that they entered
matches ONE of the strings in a list.

So what i am asking is:

How would i write this pseudo in Javascript:

var myList : List;
var myString : String;

myList = [123, ABC, 789, XYZ];

function OnGUI(){
    blaablaa make a text box for input
}

function FixedUpdate(){
    //If what was entered into myString is either 123, ABC, 789 OR XYZ
    if (myString == myList){
    //Do Something
    }
}

Yeah basically, BUT myString must equal ONE and JUST ONE of the things
in the list we created. So for example, the if statement would only be
true if the user enters: XYZ into the text box… NOT if they enter:
ABC, 123, 798, XYZ…

I am pretty sure i would have cleared up any confusion by now, if there
is a way, even with arrays, please tell me… Oh it can be in C#, but
preferably Javascript please! Thank you! :slight_smile:

import System.Collections.Generic;

#pragma strict
var strings : List.<String>;
var justAString : String;

function Start()
{
  strings = new List.<String>();
  strings.Add("ABC");
  strings.Add("123");
  strings.Add("blah");
  
  justAString = "ABC";
}

function Update ()
{
  if (strings.Contains(justAString))
  	Debug.Log("Contains what justAString is set to: " + justAString);
}

if (System.Array.IndexOf (myList, myString) != -1)