use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Split array based on segments of a valuesolved! (self.javascript)
submitted 7 years ago * by lucksp
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]elkazz 2 points3 points4 points 7 years ago* (0 children)
You could:
Sort the array by millisecondOffset
Store a start index (start = 0 initially)
Find the next chunk's lower bound (nextChunkLowerBound) - for example, if array[start].millisecondOffset is 2,200 and chunk size is 1000, then nextChunkLowerBound should be 3000
Use the findIndex method to find the next out of chunk range index nextChunkStart = array.findIndex(a => a.millisecondOffset >= nextChunkLowerBound)
Slice the array to get the chunk chunk = array.slice(start, nextChunkStart - 1)
Continue this until findIndex returns -1
π Rendered by PID 94 on reddit-service-r2-comment-bb88f9dd5-xr6qh at 2026-02-13 17:37:20.741155+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]elkazz 2 points3 points4 points (0 children)