---
title: "Comment by Tony B on \"Moving Zeros Code Challenge - JavaScript Data Structures and Algorithms\" | Hashnode"
description: "Nice article. If performance isn&#39;t a huge concern, you can also just do this. arr.sort( (a,b) =&gt; !!b - !!a) In recent versions of JavaScript the array so"
url: "https://hashnode.com/posts/moving-zeros-code-challenge-javascript-data-structures-and-algorithms/5fbd4c20ec43af1ba609509c/comment/5ff61acce8e57e1374e6af23"
---

[Discussion](https://hashnode.com/posts/moving-zeros-code-challenge-javascript-data-structures-and-algorithms/5fbd4c20ec43af1ba609509c)

Comment [Moving Zeros Code Challenge - JavaScript Data Structures and Algorithms](https://hashnode.com/posts/moving-zeros-code-challenge-javascript-data-structures-and-algorithms/5fbd4c20ec43af1ba609509c)

[Tony B](https://hashnode.com/@octree)

[Jan 6, 2021](https://hashnode.com/posts/moving-zeros-code-challenge-javascript-data-structures-and-algorithms/5fbd4c20ec43af1ba609509c/comment/5ff61acce8e57e1374e6af23)

Nice article.

If performance isn't a huge concern, you can also just do this.

```
arr.sort((a,b) => !!b - !!a)
```

_In recent versions of JavaScript the array sort is stable so the order of equal elements from the compare remains unchanged_
