var arr1 =new Array("Luffy","Zoro","Sanji");
var arr2 =new Array("Cocoro","Qimonni","Kumbei","Iceberg");
var arr3 =new Array("Kunis","Ganfulu","Weibo","Laki");
var arrAll1 = new Array(arr1,arr2,arr3);
console.log( arrAll1.toString() );
arrAll2=new Array().concat(arr1,arr2,arr3)
console.log( arrAll2.toString() );
Are arrAll1 and arrAll2 here the same array??
Anyway, it’s not a thing in PHP, but I don’t know if it is a thing here;
But using tostring here looks the same;
Reply content:
var arr1 =new Array("Luffy","Zoro","Sanji");
var arr2 =new Array("Cocoro","Qimonni","Kumbei","Iceberg");
var arr3 =new Array("Kunis","Ganfulu","Weibo","Laki");
var arrAll1 = new Array(arr1,arr2,arr3);
console.log( arrAll1.toString() );
arrAll2=new Array().concat(arr1,arr2,arr3)
console.log( arrAll2.toString() );
Are arrAll1 and arrAll2 here the same array??
Anyway, it’s not a thing in PHP, but I don’t know if it is a thing here;
But using tostring here looks the same;
Obviously different. arrAll1 is a two-dimensional array, arrAll2 is a one-dimensional array
You will know when you visit:
arrAll1[0][0]; // "Luffy"
arrAll2[0]; // "Luffy"
The answers are the same, but you will find that they have some differences, as follows:
arrAll1.length; //The result is 3
arrAll2.length; //The result is 11
This is the difference, the first one just puts the three arrays together,
while the second one does take out each element of the three arrays separately and puts them into arrAll2