---
title: "Discussion on \"CodeWars: Sort the odd\" | Hashnode"
description: "Discussion on \"CodeWars: Sort the odd\". Kata: Link\n\nYou have to create an algorithm that will swap only the odd numbers, this was the solution submitted by me:\nfunction sortArray(array){\n  const odds = array\n    .filter( item => item % 2)\n    .sort((a,b) => a < b ? -1 : 1)\n  return array\n ..."
url: "https://hashnode.com/posts/codewars-sort-the-odd/6024ad8a50d5e944c5d47ed2"
---

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

Discussion

# [CodeWars: Sort the odd](https://blog.cupofcraft.dev/codewars-sort-the-odd?utm_source=hashnode&utm_medium=feed)

Kata: Link You have to create an algorithm that will swap only the odd numbers, this was the solution submitted by me: function sortArray(array){ const odds = array .filter( item => item % 2) .sort((a,b) => a < b ? -1 : 1) return array ...

Feb 11, 2021 · 2 min read · blog.cupofcraft.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#learning-journey](https://hashnode.com/tag/learning-journey)

## Written by

[Andrea Barghigiani](https://hashnode.com/@cupofcraft)

@cupofcraft · Alcamo, Italy

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

Web, Creative, Teacher

Product Engineer with more of a decade of experience, now working on careercraft.ing to help engineers all over the world to progress in their careers without losing a single win.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
