re: Daily Challenge #32 - Hide Phone Numbers VIEW POST

FULL DISCUSSION
 

JavaScript

const hideNumbers = num => num.match(/^\d{3}\-\d{3}\-\d{4}$/) 
                           ? num.substring(0,5) + num.substring(5).replace(/\d/g, "X")
                           : false;

Live demo on CodePen.

code of conduct - report abuse