ericcornelissen / ericcornelissen/pp-runtime-gadgets

`delete arr[i]` leaves a hole/gap in the array

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Various gadgets described require arrays with holes (e.g. [`Array.prototype.shift`](https://github.com/ericcornelissen/pp-runtime-gadgets/blob/061c19b098f33bc20b33f0d4debcf7e614c9421e/pocs/ArrayPrototypeShift-%3Cn%3E.PoC-2.js)). One (unexpected) way these may be introduced at runtime is with a `delete` of an index in the array.

I came across this while reading [The Essence of JavaScript](https://arxiv.org/abs/1510.00925), in particular Figure 3:

```javascript
function sum(arr) {
var r = 0;
for (var i = 0; i < arr["length"]; i = i + 1) {
r = r + arr[i] };
return r };

sum([1,2,3]); // 6
var a = [1,2,3,4];
delete a["3"];
sum(a); // NaN
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue points to pocs/ArrayPrototypeShift-.PoC-2.js and demonstrates the behavior with the delete a["3"] example. Start by reading that PoC and the repository structure; the issue does not specify a target file, tests, or acceptance criteria, so completion would first require defining how this case should be represented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.