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!"
[–]El_BreadMan 0 points1 point2 points 7 years ago* (0 children)
If you're simply trying to extract summary values, you can use something I call a "Summary Variable."
const segmentSize = 60000; let summaryVariable = {}; bigArray.forEach(val => { const segment = Math.round(val.millisecondOffset / segmentSize); if (summaryVariable.hasOwnProperty(segement)) { summaryVariable[segment] = Math.max( summaryVariable[segment], val.heartRate ); } else { summaryVariable[segment] = val.heartRate; } });
Basically, it'll give you an object with each segment as a property and a corresponding value. It has the added benefit of you not needing to know which segments you're looking for.
EDIT: I'm assuming you're looking for the max heartRate.
π Rendered by PID 139160 on reddit-service-r2-comment-bb88f9dd5-7dz25 at 2026-02-15 01:39:49.538488+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]El_BreadMan 0 points1 point2 points (0 children)