Skip to content

[documentation] Float64Array.sort() sorts elements numerically instead of in ASCII character orderΒ #45876

@Yonom

Description

@Yonom

Bug Report

πŸ”Ž Search Terms

Float64Array TypedArray Float32Array documentation sort ascii typescript

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about documentation

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

new Float64Array([1000, 1, 2]).sort()

// documentation on Float64Array.sort(): If [compareFn is] omitted, the elements are sorted in ascending, ASCII character order.

// expected as per docs
// [1, 1000, 2]

// actual
// [1, 2, 1000]

πŸ™ Actual behavior

The code behaves differently than the documentation states it. The elements are sorted numerically and not by ASCII character order.

πŸ™‚ Expected behavior

I expected the documentation to match with the actual behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDocsThe issue relates to how you learn TypeScriptGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions