MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / pop

Method pop

stacks/triple-stack.js:30–40  ·  view source on GitHub ↗
(stack)

Source from the content-addressed store, hash-verified

28 }
29
30 pop(stack) {
31 let length = this._getLength(stack),
32 value;
33 if (length > 0) {
34 let idx = (length - 1) * 3 + stack - 1;
35 value = this._array[idx];
36 this._array[idx] = undefined;
37 --this._lengths[stack - 1];
38 }
39 return value;
40 }
41
42 peek(stack) {
43 let length = this._getLength(stack),

Callers

nothing calls this directly

Calls 1

_getLengthMethod · 0.95

Tested by

no test coverage detected