How do I find a String in an Array?

humanReadableWord is declared at the top of the file and works. I can print it and I get a string. I’m able to print the array with allWords just fine. I can pull from the array. I can print this.humanReadableWord with no problem but I can’t compair them for some reason… I think.

var humanReadableWord : String;

function Update(){
    var selectedLetters = GameObject.Find("SelectedLetters").GetComponent(SelectedLetters);
    var currentWordInProgress = selectedLetters.selectedLettersArray;
    this.humanReadableWord = (currentWordInProgress).Join("");
}

function ValidateWord(){
    var linkToDictionary = GameObject.Find("Dictionary").GetComponent(Dictionary);
    var allWords = linkToDictionary.dictionaryWords;
    var currentWord = ""+this.humanReadableWord;

    for (var i = 0; i < allWords.length; i++) {
//   print(this.humanReadableWord);  <--Works
       if(allWords *== currentWord){*

print(“testing!!”);
}
}
}
I have a call to the function below this that I also know is working…

Use Array.Contains; you don’t need to loop through the array yourself. Also I don’t know what “var currentWord = “”+this.humanReadableWord;” is for since it’s not doing anything…you can just use the humanReadableWord variable instead.

first try printing out the variable currentWord. And if the log is what you want then maybe the array value at i is not a match. You could also try using === which implies strictly equal