title: problem in comparing element of two array and if element matches then modifies another array value with some condition
body: <p>I want to compare  x and  z and if element in x is present in  z then push element of y in  temp else push 0 in temp at the end length of z and temp should be equal.
  below is my code ---</p>
  
  <pre><code>  var x=[00,03,06,21]
          var y=[79,11,18,14]
          var temp=[]
          var z=[00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
  
   for(var i=0;i&lt;z.length;i++){
                  for(j=0;j&lt;x.length;j++){
                      if(z[i]==x[j]){
                        //  alert("hello")
                          temp.push(y[j])
                      }                  
                  }
                  if(z[i]!=x[j]){
                      temp.push(0)
                  }
              }
              console.log(temp)
              console.log(z)
  
      i getting the output as -
  
      //temp  (29) [79, 0, 0, 0, 11, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0] 
     //z     (25) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] 
  
          expected output --
  
          //temp (25) [79, 0, 0, 11, 0, 0, 18, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  14, 0, 0, 0]
          //z    (25) [0,  1, 2, 3, 4,  5, 6,  7, 8,  9, 10,  11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 
                       24] 
  </code></pre>