我有一个静态数组和一个用ajax post函数填充的数组。现在我计划为动态数组替换静态数组,但事实证明这两个数组似乎彼此不同。
Array1(静态)
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object…]
[0 … 99]
0: Object
data: "AFN"
value: "Juan"
__proto__: Object
数组2(动态)
[Array[122]]
0: Array[122]
[0 … 99]
0: Object
data: "54, rue Royale"
value: "Atelier graphique"
__proto__: Object
我希望这有任何意义,但如果我需要分享更多信息或代码,请告诉我们!我们的想法是使数组2看起来与数组1相同。
答案 0 :(得分:0)
仍然不知道我是怎么陷入这个烂摊子但是我用
解决了我的问题var array1= array2[0].concat();
显然,在Salman A的评论的帮助下。