javascript - Check each item of one array for matches in another array -


i trying program word game player types words he/she finds text box , hits submit. after hitting submit, word stored in array can in javascript, , textbox cleared can enter word. think can figure parts out (i new html , javascript), have no idea how want next. need check each of words player found against array of verified words. have found codes on here search whether single word matches strings array, how write code checks of words player finds against dictionary/verified array?

you can iterate on every element in user array , use indexof see if exists in verified array. indexof return -1 if not found.

for (var = 0; < userarray.length ; i++)      if(verifiedwordarray.indexof(userarray[i]) == -1)         return false;      return true; 

if have match specific position, trick assuming both of same length.

for (var = 0; < userarray.length ; i++)      if(userarray[i] != verifiedwordarray[i])         return false;      return true; 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -