// skip the indices before n because they're null AND
returni>=n&&a
// grab the slice of a using the current index then subtract 1 from n
// and the index +1 to always give you n numbers
.slice(i-(n-1),i+1)
// add up the slice
.reduce((acc,d)=>acc+d)>
// see if its greater than the prior slice (not n-1)
a.slice(i-n,i).reduce((acc,d)=>acc+d)
})
}
generic_slider(measurements,1)
generic_slider(measurements,3)
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.