Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const numericCharAlphabetTuples = [
  3.   ['0','a'],
  4.   ['1','b'],
  5.   ['2','c'],
  6.   ['3','d'],
  7.   ['4','e'],
  8.   ['5','f'],
  9.   ['6','g'],
  10.   ['7','h'],
  11.   ['8','i'],
  12.   ['9','j'],
  13. ];
  14.  
  15. function replaceNumbersInStringToAlphabet(string) {
  16.   numericCharAlphabetTuples.forEach(tuple => {
  17.     const numericChar = tuple[0];
  18.     const alphabet = tuple[1];
  19.     string = string.replace(numericChar, alphabet);
  20.   });
  21.  
  22.   return string;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement