There might be some items in a list, as well as in a stream, that you do not want. What you do to fix that is to create a filter that filters out the unwanted data. Modeling our initial array, the manipulation, and the resulting array, we get the following:
In JavaScript, we can accomplish this by writing the following code:
let array = [1,2,3];let filtered = array.filter(data => data % 2 === 0);