Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mediante filter crea un nuevo array con todos los elementos que cumplan la condición implementada por
- //la función dada, en este caso, aquellos numeros del array que divididos en 2 nos retornen 0.
- var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- var numPares = array.filter(function(array){return array % 2 == 0;});
- console.log(numPares);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement