So, when you concatenate two arrays in javascript, you shouldn't add the original array to the list of arrays to concatenate, unless you want to exponentially grow the array.
{
var array1 = [ 'John Locke' , 'Jack Shepard' ];
var array2 = [ 'Michael Scott', 'Dwight Schrute'];
var array3 = array1.concat(array2);
}
array3 is === [ 'John Locke' , 'Jack Shepard' , 'Michael Scott' , 'Dwight Schrute'];
No comments:
Post a Comment