Skip to content

Instantly share code, notes, and snippets.

@TimeBandit
Last active March 19, 2019 06:29
Show Gist options
  • Save TimeBandit/b7fe786145c135e564ea3c1b1a4c437f to your computer and use it in GitHub Desktop.
Save TimeBandit/b7fe786145c135e564ea3c1b1a4c437f to your computer and use it in GitHub Desktop.
truncating an array #js #patterns
// truncate the array if too many
if (data.length > MAX_ENTRIES) {
data = data.slice(0, MAX_ENTRIES);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment