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.
Search Terms
indexOf, lastIndexOf, JSDoc, documentation, -1
Version & Regression Information
All versions
Playground Link
N/A
Code
The
Arrayinterface'sindexOfandlastIndexOfdescriptions 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
ReadonlyArrayand all TypedArray interfaces (Int8Array, Uint8Array, Float32Array, etc.) which all include the -1 returndocumentation.
Expected behavior
Consistent JSDoc across all array-like interfaces, matching the MDN documentation.
Actual behavior
Array.indexOfandArray.lastIndexOfare missing the -1 return behavior in their JSDoc.