Last active
March 19, 2019 06:29
-
-
Save TimeBandit/b7fe786145c135e564ea3c1b1a4c437f to your computer and use it in GitHub Desktop.
truncating an array #js #patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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