Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
>encode('hello')<"h2ll4">decode('h2ll4')<"hello">encode('Step 1: Create a function called encode() to replace all the lowercase vowels in a given string with numbers according to the following pattern:')<"St2p 1: Cr21t2 1 f5nct34n c1ll2d 2nc4d2() t4 r2pl1c2 1ll th2 l4w2rc1s2 v4w2ls 3n 1 g3v2n str3ng w3th n5mb2rs 1cc4rd3ng t4 th2 f4ll4w3ng p1tt2rn:">decode('St2p 1: Cr21t2 1 f5nct34n c1ll2d 2nc4d2() t4 r2pl1c2 1ll th2 l4w2rc1s2 v4w2ls 3n 1 g3v2n str3ng w3th n5mb2rs 1cc4rd3ng t4 th2 f4ll4w3ng p1tt2rn:')<"Step a: Create a function called encode() to replace all the lowercase vowels in a given string with numbers according to the following pattern:"// Well, I prefer alpha bullets anyway :|
Edit: inputString => inputString.replace(/./g, c => replacementMapping[c] ?? c) is a less supported but better choice -- caniuse.com/#search=%3F%3F
Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
Let's do it in JS using neat little generic HOF...
Bit of a sanity check:
Edit:
inputString => inputString.replace(/./g, c => replacementMapping[c] ?? c)
is a less supported but better choice -- caniuse.com/#search=%3F%3FVery nice
Cheers