Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSBuffer pool and allocationSingle-choice MCQ

A Buffer view over a TypedArray and the original share an ArrayBuffer. Why can Buffer.prototype.slice (legacy semantics) be a footgun compared to Uint8Array.prototype.slice?

const u = new Uint8Array([1,2,3,4]); const b = Buffer.from(u.buffer); const s = b.slice(1, 3); s[0] = 99; console.log(u[1]);