array.filter()
This function creates a new Array that returns all the values from an array that match the given filter.
array.filter( filter=function, parallel=boolean, maxThreads=number )
Returns: Array
Examples
fruitArray = [{fruit='apple', rating=4}, {fruit='banana', rating=1}, {fruit='orange', rating=5}, {fruit='mango', rating=2}, {fruit='kiwi', rating=3}];
<span class="nv">favoriteFruits</span> <span class="o">=</span> <span class="nf">fruitArray.filter</span><span class="p">(</span><span class="nf">function</span><span class="p">(</span><span class="nv">item</span><span class="p">){</span>
<span class="nv">return</span> <span class="nv">item.rating</span> <span class="o">>=</span> <span class="m">3</span><span class="p">;</span>
<span class="p">});</span>
<span class="nf">dump</span><span class="p">(</span><span class="nv">favoriteFruits</span><span class="p">);</span>