I need your help!
I have this code;
let myArray = ['he123llo', 'cats', 'wor123ld', 'dogs']; const result = myArray.map(x =>x .replace('1', '') .replace('2', '') .replace('3', '') .replace('s', '') ); console.log(result); //[ 'hello', 'cat', 'world', 'dog' ]
It works great however I’d prefer to have two arrays like this;
let myArray = ['he123llo', 'cats', 'wor123ld', 'dogs']; let replaceStrings = ['1','2','3','s'];
Then feed them into a function that accepts two arguments and returns the same result as the above script.
Any help would be awesome!
Thanks in advance.