Google Apps Script find a value in an Array
<p>I can't figure out how to check if a value exists in an Array. I assumed this should be trivially simple, but can't get there.</p>

<p>I have this code:</p>

<pre><code>function findPlayer() {
 //This section gets the values from the first row of all the columns
 var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Players");
 var lastColumn = ss.getLastColumn()
 var playerNameRow = ss.getRange(1, 2, 1, lastColumn - 3); 
 var playerNameValues = playerNameRow.getValues(); 

 //This just sets the value we're looking for (which in this example is in the 7th Column "G"). And logs the Array, just to check it.
 var findPlayer = "Dan";
 Logger.log(playerNameValues)


 //and here we just loop through the playerNameValues array looking for the findPlayer value
 for(var n in playerNameValues){
 if(playerNameValues[n][0]== findPlayer) {break}
}

//and here, if the above search does find the matching value it should log it 
Logger.log(n);
}
</code></pre>

<p>What's happening is the playerNameValue is logging correctly, but n is always logging as 0. Which implies it's finding the value in the first item it checks, rather than column 7 where the value is.</p>