Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 26, 2021 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/075cb196afe50ac6c8472f4a7fa145d4 to your computer and use it in GitHub Desktop.
Save parzibyte/075cb196afe50ac6c8472f4a7fa145d4 to your computer and use it in GitHub Desktop.
// https://parzibyte.me/blog
const arreglo = ["Luis", "María", "Maggie", "Grimm"];
const primerosDosElementos = arreglo.slice(0, 2);
console.log("El arreglo original es: ");
console.log(arreglo);
console.log("El arreglo cortado es: ");
console.log(primerosDosElementos);
/*
El arreglo original es:
[ 'Luis', 'María', 'Maggie', 'Grimm' ]
El arreglo cortado es:
[ 'Luis', 'María' ]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment