JSFiddle - React, Tailwind, and code Playground

by Lazaro Contreras

JavaScript

function concat(...txt) {
  return txt.length ? (txt[0] + concat(...txt.slice(1))) : ''
}

function cnt(...txt) {
  console.log(concat(...txt).replace(/(?<=\b(.{4})+)(\B)/g, '\n'));
}

class curry {
  args = []
  fnc(f) {
    return (...e) => {
      this.args.push(...e)
      return e.length ? this.fnc(f) : f(...this.args)
    }
  }
}

let _ = new curry().fnc(cnt)

_
  ('0', '1', '0', '1')
  ('2', '1', '0', '1')
  ('0', '1', '2', '1')
()