#2,480 建立於 2024年10月16日
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/2b469bee475a8f3f2767f4669864acdd89654017/test/no-useless-spread.mjs#L259
[!NOTE] The concat() method preserves empty slots if any of the source arrays is sparse. via MDN
[!NOTE] The concat() method preserves empty slots if any of the source arrays is sparse.
via MDN
const foo = new Array(5); const bar = new Array(5); const cat = [...foo.concat(bar)]; // now we got a new array with undefined x 10 // but foo.concat(bar) is empty x 10. // It's not what we want.
每日 Newsletter
訂閱 GoodFirstIssue Daily,取得最新發現、適合新手開始真實開源工作的 Easy issues。
不發垃圾郵件。你可以在任一封郵件中退訂。