fork download
  1. function translatePlantLatin(message) {
  2. /* Enter your solution here! */
  3. const m = {
  4. a: 'tiva',
  5. e: 'llia',
  6. i: 'mus',
  7. o: 'phylum',
  8. u: 'rea'
  9. };
  10. var res = "";
  11.  
  12. for(let c of message){
  13. if(m[c.toLowerCase()]) res+=(c+m[c.toLowerCase()]);
  14. else res+=c;
  15. console.log(res);
  16. }
  17. return res;
  18. }
  19. console.log(translatePlantLatin("I love water!"));
Success #stdin #stdout 0.02s 17012KB
stdin
Standard input is empty
stdout
Imus
Imus 
Imus l
Imus lophylum
Imus lophylumv
Imus lophylumvellia
Imus lophylumvellia 
Imus lophylumvellia w
Imus lophylumvellia wativa
Imus lophylumvellia wativat
Imus lophylumvellia wativatellia
Imus lophylumvellia wativatelliar
Imus lophylumvellia wativatelliar!
Imus lophylumvellia wativatelliar!