Skip to content

Instantly share code, notes, and snippets.

@GeekaholicLin
Last active December 9, 2016 07:04
Show Gist options
  • Save GeekaholicLin/72b123f436013d4072da46646e6e4390 to your computer and use it in GitHub Desktop.
Save GeekaholicLin/72b123f436013d4072da46646e6e4390 to your computer and use it in GitHub Desktop.
call和apply参数的区别
var arr = [5, 6, [1, 2], [3, 4]];
console.log(Array.prototype.concat.call([], arr));     // [5, 6, [1, 2], [3, 4]]
console.log(Array.prototype.concat.apply([], arr));    // [5, 6, 1, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment