mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Create change-array-by-copy.js
This commit is contained in:
11
examples/change-array-by-copy.js
Normal file
11
examples/change-array-by-copy.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const sequence = [1, 2, 3];
|
||||
sequence.toReversed(); // => [3, 2, 1]
|
||||
sequence; // => [1, 2, 3]
|
||||
|
||||
const outOfOrder = new Uint8Array([3, 1, 2]);
|
||||
outOfOrder.toSorted(); // => Uint8Array [1, 2, 3]
|
||||
outOfOrder; // => Uint8Array [3, 1, 2]
|
||||
|
||||
const correctionNeeded = [1, 1, 3];
|
||||
correctionNeeded.with(1, 2); // => [1, 2, 3]
|
||||
correctionNeeded; // => [1, 1, 3]
|
||||
Reference in New Issue
Block a user