Skip to content

accept a second parameter#2

Merged
michaelficarra merged 2 commits intomainfrom
second-parameter
Feb 3, 2026
Merged

accept a second parameter#2
michaelficarra merged 2 commits intomainfrom
second-parameter

Conversation

@michaelficarra
Copy link
Copy Markdown
Member

Fixes #1.

1. If _skippedElements_ is *undefined*, then
1. Let _skipRemaining_ be 0.
1. Else,
1. If _skippedElements_ is not one of *+∞<sub>𝔽</sub>*, *-∞<sub>𝔽</sub>*, or an integral Number, throw a *TypeError* exception.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to accept -∞ here since we're going to throw below anyway.

Also, I weakly feel that we should coerce to match [].includes, though since we're already handling negative inputs differently it's less important than for e.g. .join.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We accept -∞ so that we can throw a RangeError for it instead of TypeError.

I don't want to coerce in new APIs unless we feel it's really important to do so, which I don't think is the case here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, the error is a fine reason.

I do not feel it's really important to coerce here although I do think you should call that out in committee explicitly.

@michaelficarra michaelficarra force-pushed the second-parameter branch 2 times, most recently from 02db3e7 to 04be590 Compare February 3, 2026 22:26
@michaelficarra michaelficarra merged commit 46c07c2 into main Feb 3, 2026
2 checks passed
@michaelficarra michaelficarra deleted the second-parameter branch February 3, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throw on second argument (or treat like Array, except negative values)

2 participants