---
title: "Discussion on \"Removing zeros from an array with JavaScript's filter() method\" | Hashnode"
description: "Discussion on \"Removing zeros from an array with JavaScript's filter() method\". I recently completed a coding challenge on  edabit.com where one of the objectives was to remove all 0 values from an input array. Naturally I reached for the filter() method to do something like this:\nconst array = [1, 0, 2, 0, 3, 0, 0, 4];\n\nfunctio..."
url: "https://hashnode.com/posts/removing-zeros-from-an-array-with-javascripts-filter-method/5f66e1f635d6463d2b5f89a0"
---

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

Discussion

# [Removing zeros from an array with JavaScript's filter() method](https://rcatwr.hashnode.dev/removing-zeros-from-an-array-with-javascripts-filter-method?utm_source=hashnode&utm_medium=feed)

I recently completed a coding challenge on edabit.com where one of the objectives was to remove all 0 values from an input array. Naturally I reached for the filter() method to do something like this: const array = \[1, 0, 2, 0, 3, 0, 0, 4\]; functio...

Sep 20, 2020 · 1 min read · rcatwr.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array-methods](https://hashnode.com/tag/array-methods)

## Written by

[Rich Minardi](https://hashnode.com/@rcatwr)

@rcatwr · Vancouver Island, Canada

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

Frontend Developer

I am a frontend developer from Vancouver Island, BC, Canada, currently learning React.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
