function rFilter(fn, arr) {
  if (arr.length === 0) return [];
  [head, ...tail] = arr;
  return fn(head)
    ? [head].concat(rFilter(fn, tail))
    : rFilter(fn, tail);
}

arr = [1,2,3,4,5];
console.log('input array:', arr);

odds = rFilter(e => e%2, arr);
console.log('odds filtered:', odds);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: