subset¶
Filter values of a sequence by subsetting the values according to their position.
See also filter.
Syntax¶
subset(from[,to])
Parameter | Description |
---|---|
from |
0-based index (inclusive) from which value should be included. |
to |
Optional 0-based index (exclusive) to which value should be included |
Examples¶
Subset sequence values from a position and its equivalent filter:
$('SequenceVar').subset(1)
// is equivalent to the filter:
$('SequenceVar').filter(function(value,index) {
return index>=1;
})
Subset sequence values in a position range and its equivalent filter:
$('SequenceVar').subset(1,4)
// is equivalent to the filter:
$('SequenceVar').filter(function(value,index) {
return index>=1 && index<4;
})