ES6 - Filtro metodo array ()
Il metodo filter () crea un nuovo array con tutti gli elementi che superano il test implementato dalla funzione fornita.
Sintassi
array.filter(callback[, thisObject]);
Parametri
callback - Funzione da testare per ogni elemento.
thisObject - Oggetto da usare come questo quando si esegue la richiamata.
Valore di ritorno
Restituisce l'array creato.
Esempio
function isBigEnough(element, index, array) { 
   return (element >= 10); 
} 
var passed = [12, 5, 8, 130, 44].filter(isBigEnough); 
console.log("Test Value : " + passed );
Produzione
Test Value :12,130,44                    