A view shares, a copy does not
A three-tile buffer, a view on its first tile, and a full copy.
const original = Buffer.from('cat');const view = original.subarray(0, 1);const copy = Buffer.from(original);view[0] = 0x62;console.log('original ' + original.toString());copy[0] = 0x72;console.log('original ' + original.toString());console.log('copy ' + copy.toString());1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…