Instead of:
while (arrayTwo.length > 0)
arrayOne.push(arrayTwo.shift());You can just have:
arrayOne = arrayOne.concat(arrayTwo);I talked about the array.concat() method yesterday, and knew that it concatenated one array onto the end of another for display -- what I forgot about was JavaScript's ease of use in things like this! You just take that output and assign it to another array, in this case, the array I'm concatenating onto.
...
I still think my code was neat, though. :p
No comments:
Post a Comment