how to do a “flat push” in javascript?
问题 I want to push all individual elements of a source array onto a target array, target.push(source); puts just source's reference on the target list. In stead I want to do: for (i = 0; i < source.length; i++) { target.push(source[i]); } Is there a way in javascript to do this more elegant, without explicitly coding a repetition loop? And while I'm at it, what is the correct term? I don't think that "flat push" is correct. Googling did not yield any results as source and target are both arrays.