Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

ArrayBuffer.prototype.slice()

2 tags 1 category

The slice() method of ArrayBuffer instances returns a new ArrayBuffer whose contents are a copy of this ArrayBuffer’s bytes from start, inclusive, up to end, exclusive. If either start or end is negative, it refers to an index from the end of the array, as opposed to from the beginning.

Return value: A new ArrayBuffer containing the extracted elements. It is not resizable, even if the original was.

Parameters: start Zero-based index at which to start extraction, converted to an integer. Negative index counts back from the end of the buffer — if -buffer.length <= start < 0, start + buffer.length is used. If start < -buffer.length or start is omitted, 0 is used. If start >= buffer.length, an empty buffer is returned. end Zero-based index at which to end extraction, converted to an integer. slice() extracts up to but not including end. Negative index counts back from the end of the buffer — if -buffer.length <= end < 0, end + buffer.length is used. If end < -buffer.length, 0 is used. If end >= buffer.length or end is omitted is undefined, buffer.length is used, causing all elements until the end to be extracted. If end implies a position before or at the position that start implies, an empty buffer is returned.

Syntax example: slice()

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…