问题描述:

I was reading about concat() method and came across this:

var arr = [].concat.call( ['a', 'b', 'c'], [1,2,3]);

console.log(arr); //prints ["a", "b", "c", 1, 2, 3]

I'm trying to understand how we got the output there correctly merged. So for call() method, we got to pass the "this" as the first parameter and other parameters as arguments to the function. So for "this" are we passing ['a', 'b', 'c'] ? If so, how come concat() is working like that?

What is the advantage of concatenating in the above way instead of

['a', 'b', 'c'].concat([1,2,3]);

Both yield the same output

相关阅读:
Top