Skip to content

Array.indexOf/lastIndexOf JSDoc missing -1 return behavior #63403

@Bodlux

Description

@Bodlux

Search Terms

indexOf, lastIndexOf, JSDoc, documentation, -1

Version & Regression Information

All versions

Playground Link

N/A

Code

The Array interface's indexOf and lastIndexOf descriptions say "Returns the index of the first/last occurrence of a value in an array" but omit the
", or -1 if it is not present" clause.

This is inconsistent with ReadonlyArray and all TypedArray interfaces (Int8Array, Uint8Array, Float32Array, etc.) which all include the -1 return
documentation.

Expected behavior

Consistent JSDoc across all array-like interfaces, matching the MDN documentation.

Actual behavior

Array.indexOf and Array.lastIndexOf are missing the -1 return behavior in their JSDoc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions