Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

How to check an element of a string array with a string

$
0
0
I am having an issue checking a specific element of a string array with a string of my choice. Here is the idea: Array[0] has a string value which is read off the first line of a text file. I have the play input a string value. The inputted value is checked with Array[0] And... It tells me if the player has won or not. Seems easy enough... I could go for "if (array[0] == playervalue)..." but that doesn't work for some reason. When I ran through debug tests, it says whatever string value is inputted, it doesn't accept it. I even had the value of array[0] outputted so the player could type in exactly what was in and it didn't work. I have tried Array.IndexOf etc. but those don't seem to work. Is there a sort of format the playervalue must be in?

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>