# Remove continuous elements from an array

### **let's first understand what continuous element**

![remove-continues-element](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03whs1jcceo6u2k19d73.png align="left")

in the above example, you have seen there is a repeating now I want to remove all continuous values only (not duplication) and keep 1st element of each repeating value

### **let's see how can we achieve that**

we can achieve that using the array filter method

Javascript filter accepts a callback function and that callback function accepts 3 arguments

* element: it's return an current element
    
* index(optional): it's return index current element
    
* array(optional): it's return actual array on which filter is perform
    

![Remove continues element from an array](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypn63p1wrtca598x0yl3.png align="left")

so in the above code we first check if the element index is 0 or current element is not match with previous element then we return that element

## **Wrapping up!**

Share this blog with your friends 👩🏼‍🤝‍🧑🏼 and developers 👨‍💻 you know and let them know about these

Your feedback and comments are very important to me. 💌

## **Get in touch 🤜🤛**

[Instagram](https://www.instagram.com/technonic)

[YouTube](https://www.youtube.com/c/pratik-lochawala)
