Advertisement
Guest User

Untitled

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