Skip to content

Instantly share code, notes, and snippets.

@srezasm
Created September 6, 2020 13:36
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 srezasm/2d5884d01a8f9c9ea39fc73a98d8dcc5 to your computer and use it in GitHub Desktop.
Save srezasm/2d5884d01a8f9c9ea39fc73a98d8dcc5 to your computer and use it in GitHub Desktop.
truncate an array
let array = [0, 1, 2, 3, 4, 5];
array.length = 3;
console.log(array);
// Result: [0, 1, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment