循環后數組的值丟失 - The values ​of the array after the loop are lost -开发者知识库

循環后數組的值丟失 - The values ​of the array after the loop are lost -开发者知识库,第1张

The values ​​of "end" after the loop are lost and I do not understand the reason.

循環后“結束”的值丟失,我不明白原因。

var horas = ['2','6']
var x6 = ['1','2','3','4','5','6','7']
var x5 = ['uno','dos','tres','cuatro','cinco','seis','siete']
var final = [];		
   for (var i = 0; i <= x6.length; i  ) 
   {

    if(x6[i].indexOf(horas[0])!==-1) {final.push(x5[i]);}
    if(x6[i].indexOf(horas[1])!==-1) {final.push(x5[i]);}
    if(x6[i].indexOf(horas[2])!==-1) {final.push(x5[i]);}
	 console.log(final); // here yes exists
    }			

    console.log(final); // does not exists, Does not show anything

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复