Skip to content

Fix array index out of bounds by changing someStack.length to someStack.length - 1 in the Arrays section#3146

Closed
nafasebra wants to merge 1 commit into
airbnb:masterfrom
nafasebra:master
Closed

Fix array index out of bounds by changing someStack.length to someStack.length - 1 in the Arrays section#3146
nafasebra wants to merge 1 commit into
airbnb:masterfrom
nafasebra:master

Conversation

@nafasebra
Copy link
Copy Markdown

Changed array.length to someStack.length - 1 to prevent an array index out of bounds error. The original line was causing an error, likely because the intended behavior was to access the last element or iterate safely within the array's bounds. This adjustment ensures proper array access without exceeding its limits.

@nafasebra nafasebra closed this Aug 15, 2025
@ljharb
Copy link
Copy Markdown
Collaborator

ljharb commented Aug 19, 2025

There's no such thing as an "array out of bounds error", and this is attempting to push, not mutate.

@ljharb ljharb added the invalid label Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants