---
title: "Discussion on \"Sorting in JavaScript (Why It Confuses Everyone at First 😅)\" | Hashnode"
description: "Discussion on \"Sorting in JavaScript (Why It Confuses Everyone at First 😅)\". If you’re learning JavaScript, there’s a high chance you’ve tried this:\n[10, 2, 5].sort();\n\nAnd expected:\n[2, 5, 10]\n\nBut instead, you got:\n[10, 2, 5]\n\nAt this point, most people think: “Is JavaScript"
url: "https://hashnode.com/posts/sorting-in-javascript-why-it-confuses-everyone-at-first/69c5291710e664c5dac4ff30"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sorting in JavaScript (Why It Confuses Everyone at First 😅)](https://vibha07.hashnode.dev/sorting-in-javascript-why-it-confuses-everyone-at-first?utm_source=hashnode&utm_medium=feed)

If you’re learning JavaScript, there’s a high chance you’ve tried this: \[10, 2, 5\].sort(); And expected: \[2, 5, 10\] But instead, you got: \[10, 2, 5\] At this point, most people think: “Is JavaScript

Mar 26 · 3 min read · vibha07.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#sorting-algorithms](https://hashnode.com/tag/sorting-algorithms)

## Written by

[vibha yadav](https://hashnode.com/@vibha07)

@vibha07 · Delhi, India

  
[View profile](https://hashnode.com/@vibha07)

From Bugs to Blogs

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
