I am currently attempting to locate the index of all occurrences of both Header
and Footer
within an array.
var arr = [
'data',
'data',
'data',
'data',
'Header',
'data',
'data',
'data',
'Footer',
'data',
'Header',
'data',
'Footer',
'data'
];
While I am familiar with how to achieve this using vanilla JavaScript (How to find index of all occurrences of element in array?), I am curious to see how it can be accomplished using functional programming, specifically with ramda.js
.
I have been able to find the index of the first occurrence using
R.findIndex(R.test(_regexForHeader))
, but I am struggling to figure out how to loop through the entire array. Any assistance would be greatly appreciated.