I've tried googling a bit but haven't had much success. What I'm trying to do is change every letter in a string to something else. For example "this is a string" would turn to something like "&@/- 52 - .'49-!"
So far I've got my string/phrase as
let phrase = ['a', 'b', 'c'];
then afterwards
phrase = phrase.map(phrase => {
return phrase.replace('a', '-');
return phrase.replace('b', '!');
return phrase.replace('c', ',');
return phrase.replace('d', ';');
return phrase.replace('e', ',');
return phrase.replace('f', '(');
.. all the way to Z, then
});
console.log(phrase);
When I run it, I get this output
[ '-', 'b', 'c' ]
but it should be this
[ '-', '!', ',' ]
which means it's only 'translating' the first letter and skipping the rest,whereas I need it to translate the entire string.
I'd really appreciate if someone could point me in the right direction :)