javascript - How to compare the order of two sets of data -


i have got 2 sets of data .

var array = ["one" , "two" , "three" , "four" , "five"];  var t1 = "one" ; var t2 = "two" ; var t3 = "three" ; var t4 = "four" ; var t5 = "five" ; 

i want check order of data in both sets , trying way

if(t1==array[0] && t2==array[1] && t3 ==array[2] && t4==array[3] && t5==array[4]) { alert('yes'); }  else { alert('no'); } 

but i'm getting alert "no".

could please let me know how resolve ??

http://jsfiddle.net/85utz097/

you getting "no" because

one != 1 

change this:

var t1 = "one" ; 

and "yes"!!

check demo


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -