MCPcopy Create free account
hub / github.com/bradtraversy/javascript-sandbox / pop

Method pop

17-iterators-data-structures/08-stacks/script.js:12–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 }
11
12 pop() {
13 if (this.isEmpty()) {
14 return 'Underflow';
15 }
16
17 const item = this._items[this._count - 1];
18 this._count--;
19
20 for (let i = this._count; i < this._items.length; i++) {
21 this._items[i] = this._items[i + 1];
22 }
23
24 this._items.length = this._count;
25 return item;
26 }
27
28 peek() {
29 if (this.isEmpty()) {

Callers 15

swiper.jsFile · 0.80
script.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80
swiper.jsFile · 0.80

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected