Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const replaceChars = (input, replacements) => {
- const replacementsDefault = { a: "а", c: "с", d: "ԁ", e: "е", i: "і", o: "о", s: "ѕ", y: "у", s: "ѕ", B: "В", d: "ԁ", O: "О", P: "Р", p: "р", C: "С", I: "ӏ", l: "ⅼ", L: "Ⅼ", H: "Η", M: "м" S: "Ѕ" };
- const replacementsUse = replacements ? replacements : replacementsDefault;
- const pattern = new RegExp(Object.keys(replacementsUse).join('|'), 'gu');
- return input.replace(pattern, (match) => replacementsUse[match]);
- }
- // Update the line below, between the quotes "
- const input = "the quick brown fox jumped over the lazy dog. THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.";
- const output = replaceChars(input);
- console.log(output);
Advertisement
Add Comment
Please, Sign In to add comment