Created
December 11, 2020 09:03
-
-
Save tpps88206/a52e31fab24594b55aa96a923adfbe5f to your computer and use it in GitHub Desktop.
在 JavaScript 中實作 concatAll 函數
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.concatAll = function() { | |
| var result = []; | |
| // 用 apply 完成 | |
| this.forEach((array) => { | |
| result.push.apply(result, array); | |
| }); | |
| return result; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment