mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
10 lines
359 B
JavaScript
10 lines
359 B
JavaScript
// JavaScript permits the zero-argument Array.prototype.toSpliced form even
|
|
// though TypeScript's declaration requires `start`. It returns a fresh
|
|
// shallow copy; it must not share the one-argument form's delete-to-end
|
|
// default.
|
|
|
|
const source = [1, 2, 3];
|
|
const copied = source.toSpliced();
|
|
copied[0] = 9;
|
|
console.log(copied.join(","), source.join(","));
|