Guest User

Untitled

a guest
Sep 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /*
  2. PARAMETRO DE TIPO REST, SOLO LE DIMOS DOS VALORES A LA FUNCION (fruta1 y fruta2)
  3. EL RESTO DE LOS VALORES SE GUARDARAN EN ( resto_de_frutas )
  4. LA FUNCION REST SE USA CON TRES PUNTOS
  5. */
  6.  
  7. function listadoFrutas(fruta1, fruta2, ...resto_de_frutas){
  8. console.log("Fruta 1: ", fruta1);
  9. console.log("Fruta 2: ", fruta2);
  10. console.log("Resto: ", resto_de_frutas);
  11.  
  12. }
  13.  
  14. listadoFrutas("Naranja","Manzana","Sandia","Platano","Melon","Coco");
  15.  
  16. /*
  17. PARAMETRO DE TIPO SPREAD
  18. ES CASI LO MISMO DE ARRIBA, PERO AQUI GUARDAMOS LOS VALORES EN UNA LISTA
  19. Y LO PONEMOS EN LA FUNCION UTILIZANDO TRES PUNTOS
  20. */
  21.  
  22. var frutas = ["Naranja","Manzana"];
  23. listadoFrutas(...frutas, "Sandia","Platano","Melon","Coco")
Add Comment
Please, Sign In to add comment