5 Replies Latest reply on Nov 24, 2014 12:27 AM by Jump_Over

    Compare two array value

    creativejoan0425 Level 1

      I want to compare two array value is it the same, the result that I want is can alert 1,5,6, but now the result is 6 only

       

      var myText1 = "1,3,5,6";

      var myText2 = "+1,+2, 3,+4,+5";

      var array1 = myText1.split(",");

      var array2 = myText2.split(",");

      for (var i=0; i<array1.length; i++){

      //~     alert(array2.toString().valueOf(array1[i]));

          if(array2.toString().indexOf(array1[i]) == -1){

              alert("havn't " + array1[i]);

              }

          }