Preview:
// return masked string
function maskify(cc) {
  const text = cc.replace(/\s/g,'').replace(/\w(?=\w{4})/gi,'#');
  return text
}
maskify('1')
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter