JSFiddle - React, Tailwind, and code Playground
by Cody Lindley
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
var myString = "He's an ahole. Can't believe how much of a jackass he can be!";
//Replace each letter in 'ahole' and 'jackass' with *
var updateMyString = myString.replace(/ahole|jackass/g, function (s) {
return [].map.call(s,function(){return '*'}).join('');
//or crazy cool
//return Array(s.length+1).join('*');
});
console.log(updateMyString);
/*logs
He's an *****. Can't believe how much of a ******* he can be!
*/