Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/btholt/algorithms-exercises
/ _collapseTo
Method
_collapseTo
specs/arrays/arraylist.solution.test.js:43–49 ·
view source on GitHub ↗
(index)
Source
from the content-addressed store, hash-verified
41
return
ans;
42
}
43
_collapseTo(index) {
44
for
(
let
i = index; i < this.length; i++) {
45
this.data[i] = this.data[i + 1];
46
}
47
delete this.data[this.length - 1];
48
this.length--;
49
}
50
serialize() {
51
return
this.data;
52
}
Callers
1
delete
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected