JSFiddle - React, Tailwind, and code Playground
JavaScript
var input = "javascript is awesome leet";
var replaceList = {
'a': 4,
'e': 3,
'i': 1,
'o': 0,
't': 7,
}
var output = input.split('').map(s => replaceList[s] || s).join('')
console.log(output)