Starting from an array of arbitrary values I would like to be able to extract all sequences of a given value.
So if I started with this
[1,0,1,1,1,1,0,0]
and searched for 1. I would like to get back
[[1],[1,1,1,1]]
I have seen an implementation in AS though not clear enough for me to translate over: finding sequences in AS3 array
I wrote one from scratch with code comments:
Working demo here: http://jsfiddle.net/jfriend00/YvsET/