JSFiddle - React, Tailwind, and code Playground

by oti ext

JavaScript

'abcdefg'.replace(/(.{1})/g, function(a,b,c,d){
  console.log(a,b,c,d);
  return (d.length-1 === c) ? a : a+'-';
});